Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
3690 Visualizações

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
Cancelar

Version? Community or Enterprise?

Autor

Enterprise

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

Melhor resposta

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
Cancelar

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>

Publicações relacionadas Respostas Visualizações Atividade
1
mar. 25
1281
0
nov. 24
1478
0
jun. 24
1547
1
jun. 24
2053
0
out. 23
2106