How to Modify No-Update Records in Odoo
Learn to customise "no-update” records in Odoo

What is "No-Update" Functionality?

The structure of the Odoo framework allows the creation of records or datasets through Odoo’s generic XML code. The records are supposed to be dummy data to be used for learning processes or default data to control Odoo’s base process, like security groups, access rights, record rules, etc. These records are often placed inside a special XML tag with a noupdate="1" attribute:

<data noupdate="1">

When data is loaded with this attribute, Odoo does not update it during future module upgrades. This ensures that essential configuration records, once created, stay intact even if the module is updated later.

This mechanism is especially important for base-level data like security rules and default groups that Odoo relies on to function correctly.

However, there are cases where developers or functional teams need to modify these default records. This becomes tricky because Odoo’s upgrade system ignores changes to these records — unless you explicitly allow it to overwrite them.

Modifying a Record Set to "No-Update"

Let’s walk through an example to show how this is done properly.

Step 1: Identify the Target Record

Suppose you want to modify the domain of a default record rule defined in:

addons/base/security/base_security.xml

Here’s the original rule:

<record id="res_partner_rule_private_employee" model="ir.rule">
   <field name="name">res.partner.rule.private.employee</field>
   <field name="model_id" ref="base.model_res_partner"/>
   <field name="domain_force">['|', ('type', '!=', 'private'), ('type', '=', False)]</field>
   <field name="groups" eval="[Command.link(ref('base.group_user')),]"/>
   <field name="perm_read" eval="True"/>
   <field name="perm_write" eval="True"/>
   <field name="perm_create" eval="True"/>
   <field name="perm_unlink" eval="True"/>
</record>

Let’s say we want to extend this rule by modifying the domain_force field. Before we do that, we need to make this record writable during an upgrade.

Step 2: Temporarily Disable the No-Update Flag

Add this function to your custom module to update the noupdate status of the record:

<function name="write" model="ir.model.data">
    <function name="search" model="ir.model.data">
        <value 
            eval=
            "[('module', '=', 'base'), 
              ('name', '=', 'res_partner_rule_private_employee')]"
             />
    </function>
    <value eval="{'noupdate': False}" />
</function>

This searches the ir.model.data table for the record, then sets its noupdate flag to False, which allows Odoo to apply changes to it in the upcoming XML data load.

This is the key step that tells Odoo: “You’re allowed to overwrite this record now.”

Step 3: Apply the Desired Changes

Now that the record is editable, redefine the fields you want to modify. For example:

<record id="base.res_partner_rule_private_employee" model="ir.rule">
    <field name="domain_force">['|', ('type', '!=', 'private'), ('type', '=', False), ('category_id','!=',3)]</field>
</record>

This example adds a new condition to the domain, excluding partners with category_id = 3.

Step 4: Re-enable the No-Update Flag

Once your changes have been applied, re-protect the record by setting noupdate back to True:

<function name="write" model="ir.model.data">
   <function name="search" model="ir.model.data">
     <value eval="[('module', '=', 'base'), ('name', '=', 'res_partner_rule_private_employee')]" />
   </function>
   <value eval="{'noupdate': True}" />
</function>

This final step ensures that Odoo treats the record as a protected one again, and it won’t get changed unintentionally during future upgrades.

Final Tips

  • Always test these changes in a staging environment before applying them to production.
  • Be cautious when modifying records from core modules — even small changes can have system-wide effects.
  • If you expect to modify the same record again in the future, consider managing it through a custom module instead.

Found this article useful?

Explore more development guides and solutions from our team.

Check out more posts
Muhammad⁣ Kamran 1 مايو, 2023
أرشفة
تسجيل الدخول حتى تترك تعليقاً
How to Design Resilient Odoo Crons
Tips for Designing Robust Cron Jobs in Odoo