修改已有记录规则odoo
Modify existing record rule odoo
我想将 <field name="perm_create" eval="False" />
放入现有记录规则。
所以我添加了继承它并添加了我的添加..但没有效果:
<record id="hr_attendance.hr_attendance_rule_attendance_manager" model="ir.rule">
<field name="perm_create" eval="False"/>
</record>
是因为<data noupdate="1">
。 hr_attendance_rule_attendance_manager
在 hr_attendance
和 noupdate=1
中定义。所以,您不能正常更改它。
据我所知,有两种方法可以解决这个问题。
通过 UI 删除 noupdate
。设置 > 技术 > 外部标识符 > 查找您的记录 (hr_attendance.hr_attendance_rule_attendance_manager
)。然后,取消选中“不可更新”字段。
用 xml 删除 noupdate
。我指的是这个question/answer。 https://www.odoo.com/forum/help-1/question/how-can-i-update-a-record-stored-with-the-attribute-noupdate-1-78133
- 查找记录并删除
noupdate
.
<function name="write" model="ir.model.data">
<!-- First we need to find the record...-->
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'purchase'), ('name', '=', 'purchase_order_comp_rule')]"/>
</function>
<!-- ...and temporarily set the noupdate field to False-->
<value eval="{'noupdate': False}" />
</function>
- 应用您想要的更改。
<!-- Get our main job done, i.e. modify the domain_force field of a record -->
<record id="purchase.purchase_order_comp_rule" model="ir.rule">
<field name="domain_force">[('company_id','=',user.company_id.id)]</field>
</record>
- (可选)恢复为
noupdate
True。
<!-- (Optional) Time to clean our dirty hand, set the previously noupdate False to True again -->
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'purchase'), ('name', '=', 'purchase_order_comp_rule')]"/>
</function>
<value eval="{'noupdate': True}" />
</function>
我想将 <field name="perm_create" eval="False" />
放入现有记录规则。
所以我添加了继承它并添加了我的添加..但没有效果:
<record id="hr_attendance.hr_attendance_rule_attendance_manager" model="ir.rule">
<field name="perm_create" eval="False"/>
</record>
是因为<data noupdate="1">
。 hr_attendance_rule_attendance_manager
在 hr_attendance
和 noupdate=1
中定义。所以,您不能正常更改它。
据我所知,有两种方法可以解决这个问题。
通过 UI 删除
noupdate
。设置 > 技术 > 外部标识符 > 查找您的记录 (hr_attendance.hr_attendance_rule_attendance_manager
)。然后,取消选中“不可更新”字段。用 xml 删除
noupdate
。我指的是这个question/answer。 https://www.odoo.com/forum/help-1/question/how-can-i-update-a-record-stored-with-the-attribute-noupdate-1-78133
- 查找记录并删除
noupdate
.
<function name="write" model="ir.model.data">
<!-- First we need to find the record...-->
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'purchase'), ('name', '=', 'purchase_order_comp_rule')]"/>
</function>
<!-- ...and temporarily set the noupdate field to False-->
<value eval="{'noupdate': False}" />
</function>
- 应用您想要的更改。
<!-- Get our main job done, i.e. modify the domain_force field of a record -->
<record id="purchase.purchase_order_comp_rule" model="ir.rule">
<field name="domain_force">[('company_id','=',user.company_id.id)]</field>
</record>
- (可选)恢复为
noupdate
True。
<!-- (Optional) Time to clean our dirty hand, set the previously noupdate False to True again -->
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'purchase'), ('name', '=', 'purchase_order_comp_rule')]"/>
</function>
<value eval="{'noupdate': True}" />
</function>