تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
3681 أدوات العرض

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
مارس 25
1279
0
نوفمبر 24
1475
0
يونيو 24
1547
1
يونيو 24
2045
0
أكتوبر 23
2100