Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3687 Weergaven

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.



Avatar
Annuleer

Version? Community or Enterprise?

Auteur

Enterprise

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

Beste antwoord

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

Avatar
Annuleer

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>

Gerelateerde posts Antwoorden Weergaven Activiteit
1
mrt. 25
1281
0
nov. 24
1476
0
jun. 24
1547
1
jun. 24
2050
0
okt. 23
2105