Odoo Help


Updating default rule via xml isn't working?

on 4/15/16, 6:46 AM 595 views


I want to update odoo default rule (portal rule), but the update seems never works

So, the rule I want to update is:


<record id="portal_sale_order_line_rule" model="ir.rule">

    <field name="name">Portal Sales Orders Line</field>

    <field name="model_id" ref="sale.model_sale_order_line"/>

    <field name="domain_force">[('order_id.message_follower_ids','child_of',[user.commercial_partner_id.id])]</field>

    <field name="groups" eval="[(4, ref('base.group_portal'))]"/>



and in my custom module:

<data noupdate="0">

     <record id="portal_sale.portal_sale_order_line_rule" model="ir.rule">

         <field name="domain_force">['|',






On default rules, it's defined as <data noupdate="1">

That modification works when install the custom modules on a new db, but it's doesn't works when updating existing db.  

 Thank you


On 4/18/16, 2:16 AM

I think, I found the solution (someone already posted the same problem)


Thank you zbik for your answer :)



| 6 4 7
Lodz, Poland

On 4/15/16, 2:54 PM

Try to use record attribute


for example:

<record forcecreate=True id="portal_sale.portal_sale_order_line_rule" model="ir.rule">


 <record forcecreate="True" model="ir.rule" id="sale.sale_order_comp_rule">
    <field name="name">Sales Order multi-company TEST</field>
    <field name="model_id" ref="sale.model_sale_order"/>
    <field name="global" eval="True"/>
    <field name="domain_force">['|',('company_id','=','TEST'),('company_id','child_of',[user.company_id.id])]</field>

Hi Zbik, thanks for the answer :) I've also tried that attribute, nothing happen. I've delete those rules and then updating the modules (both module, portal_sale and my custom module), the update re-create those rules, but the modification does nothing (I mean, there is no impact of the modification expected)

on 4/16/16, 6:44 AM

Answer updated. Example works without any problem in my system.

on 4/16/16, 7:53 AM

hi Zbik, with your example, is it works when you change the 'domain_force' value and then update odoo server?

on 4/17/16, 12:25 PM

In example domain_force is changed (see string 'TEST'). Yes, this works when I update my custom module. Your 'depends' are set correctly?

on 4/18/16, 6:32 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/15/16, 6:46 AM
Seen: 595 times
Last updated: 4/18/16, 2:16 AM