Odoo Help

0

How to inherit and change the domain of standard rules in odoo 8.0?

By
Maniganda
on 12/2/14, 8:14 AM 2,430 views

Hi  I need to inherit the standard rule for lead object and change the domain

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

.............

</record>

 

I have inheritted the rule and modified the domain as per the requirement. but when ever i upgrade the domain is not getting changed

how to fix this issue ?

Thanks

0
Hilar
On 3/19/17, 11:21 PM

Hi,

Just try to override the record with the same id following the pattern module_name.original_id for your custom record, before upgrading will be good to delete the rule from UI, because if the data XML have the attribute no_update = True will prevents the updates

0
Muhammad Irfan
On 3/17/17, 9:46 AM

I might be late to the party, but for everyone looking for the solution of this problem, below solution might be helpful.

Basically what Ivan wrote works fine if the inherited record has no <data noupdate="1">. What noupdate="1" does is to prevent subsequent module upgrade to override the current value of the fields, thus no matter how many times you pressed the upgrade button, no changes will take effect.

To overcome this problem, you have to do the following:

<!--Find the corresponding "to be inherited record" with noupdate="1" -->
<function name="write" model="ir.model.data">
    <function name="search" model="ir.model.data">
        <value
            eval="[('module', '=', 'crm'), ('name', '=', 'crm_rule_personal_lead')]"
         />
    </function>

    <!--Set noupdate to False--> 
    <value eval="{'noupdate': False}" />
</function>

<!--Finish the job, i.e. inheriting/modifying some fields-->
<record id="crm.crm_rule_personal_lead" model="ir.rule">
    <field name="field_to_be_changed">field_value</field>
</record>

<!--Optional, if you want to set noupdate to True again-->
<function name="write" model="ir.model.data">
    <function name="search" model="ir.model.data">
        <value
            eval="[('module', '=', 'crm'), ('name', '=', 'crm_rule_personal_lead')]"
        />
    </function>
    <!--Set noupdate to True-->
    <value eval="{'noupdate': True}" />
</function>

Hope it helps!

0
Ivan
On 12/2/14, 8:18 AM

The rule in question (XML ID crm_rule_personal_lead) is defined in crm module.  Make sure that if you want to redefine that rule, you need to specify the fully qualified XML ID: <record id="crm.crm_rule_personal_lead" model="ir.rule">... </record>

Hi John i have given fully qualified name as you specified but even though its not upgrading

Maniganda
on 12/2/14, 8:25 AM

Have you put the XML file into the 'data' section of __openerp__.py? Also you would need to put 'crm' in the 'depends' section of __openerp__.py.

Ivan
on 12/2/14, 9:11 AM

yes i did that also,

Maniganda
on 12/2/14, 9:11 AM

I'm out of ideas Maniganda. Do check the log and see if there is any errors pertaining to the loading of the rules when you upgrade. Make sure that you don't have no update turned on in the data XML.

Ivan
on 12/2/14, 9:20 AM

i have tried will 3 options 1) 2) 3) but then also no use,

Maniganda
on 12/2/14, 11:34 PM

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.

Register

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)

Stats

Asked: 12/2/14, 8:14 AM
Seen: 2430 times
Last updated: 3/19/17, 11:21 PM