首页 > 其他分享 >ODOO配置属性

ODOO配置属性

时间:2022-10-26 00:22:36浏览次数:49  
标签:name no create 配置 field ODOO invisible True 属性

2字段的属性

2.1 隐藏字段

<field name='model_name' invisible="True"/>

2.2 条件下隐藏

<field name='model_name' attrs="{'invisible':[('mdoel_name'),'=','1']}"

2.3 只读 readonly

<field name='modle_name' readonly='TRUE'/>

2.4 条件域

<field name='modle_name' domain=[('state','=','drft')]

2.5 设置值 eval

<field name='fill_date' eval='datetime.now()' readonly='True'

2.6 表单传值 context ,触发动作

<button class="oe_stat_button" name="%(budget_review_action)d" type="action" icon="fa-calendar-check-o" attrs="{'invisible':[('state','!=','check')]}" context="{'default_budget_id': id, 'default_contract_area': square, 'default_contract_price': total_price, 'default_start_date': start_date, 'default_end_date': end_date}" string="创建审核单"/>a

2.7 生成一个动态的选择

year = fields.Selection(string=u'年度', selection=[(num, str(num)) for num in range((datetime.datetime.now().year - 5), (datetime.datetime.now().year + 5))])

2.8 many2one小部件

 no_quick_create  按删除创建和编辑
<field name="field_name" options="{'no_create': True}"/>
no_create_edit - 删除创建“search_value”选项。
no_create - no_quick_create和no_create_edit组合在一起。
no_open - 处于读取模式:不渲染为链接
<field name="field_name" options="{'no_quick_create': True, 'no_create_edit' : True}"/>
 

2.9 one2many 树

<span style="color:#393a34"><code class="language-markup"><span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>field</span> <span style="color:#00a4db">name</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>basic_incidentals<span style="color:#393a34">"</span></span> <span style="color:#00a4db">mode</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>tree<span style="color:#393a34">"</span></span> <span style="color:#00a4db">nolabel</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>1<span style="color:#393a34">"</span></span><span style="color:#393a34">></span></span>
   <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>tree</span> <span style="color:#00a4db">create</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>false<span style="color:#393a34">"</span></span> <span style="color:#00a4db">edit</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>false<span style="color:#393a34">"</span></span> <span style="color:#00a4db">delete</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>false<span style="color:#393a34">"</span></span><span style="color:#393a34">></span></span>
      <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>field</span> <span style="color:#00a4db">name</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>name<span style="color:#393a34">"</span></span><span style="color:#393a34">/></span></span>
      <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>field</span> <span style="color:#00a4db">name</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>model<span style="color:#393a34">"</span></span><span style="color:#393a34">/></span></span>
      <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>field</span> <span style="color:#00a4db">name</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>specifications<span style="color:#393a34">"</span></span><span style="color:#393a34">/></span></span>
      <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>field</span> <span style="color:#00a4db">name</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>price<span style="color:#393a34">"</span></span> <span style="color:#00a4db">invisible</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>True<span style="color:#393a34">"</span></span><span style="color:#393a34">/></span></span>
      <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>field</span> <span style="color:#00a4db">name</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>number<span style="color:#393a34">"</span></span> <span style="color:#00a4db">invisible</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>True<span style="color:#393a34">"</span></span><span style="color:#393a34">/></span></span>
      <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>field</span> <span style="color:#00a4db">name</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>unit<span style="color:#393a34">"</span></span> <span style="color:#00a4db">invisible</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>True<span style="color:#393a34">"</span></span><span style="color:#393a34">/></span></span>
      <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>field</span> <span style="color:#00a4db">name</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>total_price<span style="color:#393a34">"</span></span> <span style="color:#00a4db">invisible</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>True<span style="color:#393a34">"</span></span><span style="color:#393a34">/></span></span>
      <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"><</span>field</span> <span style="color:#00a4db">name</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>remarks<span style="color:#393a34">"</span></span> <span style="color:#00a4db">invisible</span><span style="color:#e3116c"><span style="color:#393a34">=</span><span style="color:#393a34">"</span>True<span style="color:#393a34">"</span></span><span style="color:#393a34">/></span></span>
   <span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"></</span>tree</span><span style="color:#393a34">></span></span>
<span style="color:#00009f"><span style="color:#00009f"><span style="color:#393a34"></</span>field</span><span style="color:#393a34">></span></span></code></span>

标签:name,no,create,配置,field,ODOO,invisible,True,属性
From: https://www.cnblogs.com/pushuiyu/p/16826921.html

相关文章