跳至內容
選單
此問題已被標幟
1 回覆
3680 瀏覽次數

Hello,

How can I edit a rule from a module in xml ?

Update : 

I've tried in a xml file :

record id="stock.stock_production_lot_rule" model="ir.rule"

    field name="active" eval="False"

record

But i got the error "ID XML is missing"

WARNING test odoo_tools_convert : Skipping deletion for missing XML ID `'stock_production_lot_rule'`" 

Yet the ID matches the one in the rule metadata.



頭像
捨棄

Version? Community or Enterprise?

作者

Enterprise

i think this rule have noupdate=1 that's why you getting issue.

最佳答案

Hello John,


For editing an existing record rule,first you need to make the noupdate as false before making any changes in the original code,otherwise the new rule will not be reflected.
You can make it as below code : 


Find code in Comment : 


Then install the module.The rule will be modified.and Then make the noupdate as True again and upgrade the module and check.

Hope it will help you.


Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

頭像
捨棄

for eg:

If this is the original code,

<record id="stock_production_lot_rule" model="ir.rule">
<field name="name">stock production rule name</field>
<field name="model_id" ref="model_stock_production_lot"/>
<field name="groups" eval="[(4, ref('user_group_name..fill..'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
<field name="domain_force">[('....fill...)]</field>
</record>

Then first do below one,

<function name = "write" model = "ir.model.data">
<function name = "search" model = "ir.model.data">
<value eval = "[('module', '=', ' stock '), (' name ',' = ',' stock_production_lot_rule')]"/>
</function>
<value eval =" {' noupdate ': False} "/>
</function>

Then modify the rule,

<record id = "stock.stock_production_lot_rule" model = "ir.rule">
<field name = "name"> ....(updated name) </field>
<field ref = "stock.model_stock_production_lot" name = "model_id" />
<field name = "domain_force"> [(....fill..)] </field>
<field name = "groups" eval = " [(4, ref ('user_group_name..fill..'))] "/>
</record>

相關帖文 回覆 瀏覽次數 活動
1
3月 25
1279
0
11月 24
1475
0
6月 24
1547
1
6月 24
2045
0
10月 23
2100