Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
15211 มุมมอง

I am trying to inherit rule in sale order and change the domain, but nothing is happening, even though I am getting no error messages.


<record id="sale.sale_order_see_all" model="ir.rule">
<field name="name">All Orders</field>
<field ref="model_sale_order" name="model_id"/>
<field name="domain_force">[('classified','=',False)]</field>
<field name="groups" eval="[(4, ref('base.group_sale_salesman_all_leads'))]"/>
</record>
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Delete with xml record like:

<delete model="ir.rule" id="sale.sale_order_see_all"/>

You can put new rule definition after this one in same xml...

To Modify:
In groups field you copied eval value: [4,... from original xml file, this works only the firs time you add record...
in order to modify, the groups to apply you should use folowing synthax:

<field name="groups" eval="[(6, 0, [ref('base.group_sale_salesman_all_leads'), ref('optional_other_group_id')])]"/>

(replace the values in m2m relation with new ones in order to apply new rules) 

Hope it helps :)

อวตาร
ละทิ้ง

using 4,... should work for updating rules. Altough it would add a group to the rule definition and not replace it (it he needs to replace the group, then indeed 6,... is the way to do it).

But be aware, i didn't check in V8, but in V9, the rule sale_order_see_all is in a noupdate=1 tag, which means it cannot be updated by code.

So there are 2 solutions:

- delete it and recreate it by XML

- or update it through the backend

คำตอบที่ดีที่สุด

Try this:


<record id="sale.sale_order_see_all" model="ir.rule">

  <field name="domain_force">Your new domain</field> 

</record>

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ธ.ค. 19
4925
How to increase the security of Odoo ? แก้ไขแล้ว
2
ก.ย. 23
26566
0
มี.ค. 15
4153
1
ธ.ค. 22
24845
2
มิ.ย. 20
3050