Core XML Operation in Odoo

December 31, 2025 by
Core XML Operation in Odoo
Widuri Sugiyani
| No comments yet

Odoo uses XML files to define data, views, menus, security rules, and more. XML elements and directives control how Odoo processes these files during module installation and upgrades. XML help:

  • Create, update, or delete records
  • Manage view inheritance and modifications
  • Load demo data or configuration
  • Define access controls and rules

Using the right operators ensures your customizations are applied correctly and efficiently.


XML Operation


1. Odoo

The <odoo> element serves as the root container for all Odoo XML data files. While it seems simple, understanding its structure and conventions is crucial for proper module architecture.

<odoo>
​<...>
</odoo>


2. Data

<data> defines the context in which records are processed. Common attributes: 

noupdate="1" → skip updates on module upgrade 

noupdate="1" indicates that the records inside the <data> tag are loaded only during the initial module installation. When the module is upgraded, Odoo will not update or reapply these records if they already exist. This is typically used for data that should remain stable after installation, such as default configurations or reference data.

<data>
    <...>
</data>


3. Record

he <record> operator is used to create or update database records. It’s commonly used in data.xml files to define model data.

<record id="partner_demo" model="res.partner">


4. Template

Used for defining QWeb templates, which generate dynamic HTML content. Often found in report.xml or website modules.

<template id="my_template">
    <!-- OPERATION: "Define a QWeb template for rendering" -->
    <h1>Hello World</h1>
</template>


5. Fields

The <field> element is arguably the most frequently used XML operator in Odoo. It's the primary tool for setting field values within records, with powerful attributes that control data behavior.

<field name="name">John Doe</field>


6. Menuitem

Defines menu items in Odoo’s user interface. This operator helps structure navigation and access to different modules.

<menuitem id="menu_sales" name="Sales" parent="menu_root"/>


7. Delete

Removes records from the database using external IDs. Typically used for cleanup during module upgrades.

<delete model="ir.ui.view" id="old_view_id"/>


8. Function

Used sparingly to execute controlled logic during module installation or upgrade. Overuse can make modules hard to maintain. <function> is rarely recommended in modern Odoo and it runs at install/upgrade time

<function model="res.partner" name="update_all_partners"/>


Conclusion


Mastering Odoo’s core XML operators is crucial for developing robust, scalable modules. By understanding how to use <record>, <template>, <menuitem>, and other operators effectively, you can streamline your Odoo customization process and avoid common pitfalls.

Core XML Operation in Odoo
Widuri Sugiyani December 31, 2025
Share this post
Archive
Sign in to leave a comment