是因为<data noupdate="1">。 hr_attendance_rule_attendance_manager 在 hr_attendance 和 noupdate=1 中定义。所以,你不能正常改变它。
据我所知,有两种方法可以解决这个问题。
-
通过 UI 删除 noupdate。设置 > 技术 > 外部标识符 > 查找您的记录 (hr_attendance.hr_attendance_rule_attendance_manager)。然后,取消选中“不可更新”字段。
-
用 xml 删除 noupdate。我指的是这个问题/答案。 https://www.odoo.com/forum/help-1/question/how-can-i-update-a-record-stored-with-the-attribute-noupdate-1-78133
<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>
<!-- (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>