Enable Dark Mode!
assista-odoo-helper-for-vs-code-xml-keywords.jpg
By: Cybrosys Technologies

Assista Odoo Helper for VS Code - XML Keywords

Technical Cybrosys Assista VS Code Python

In Odoo development, working with XML views is just as important as Python logic, especially when designing clean, user-friendly interfaces. Rewriting repetitive XML structures for forms, trees, kanbans, and actions can slow you down and introduce subtle layout issues.

Cybrosys Assista: Odoo Helper for VS Code includes a comprehensive set of XML snippet keywords to streamline view development in Odoo 18. These snippets help you instantly scaffold structured and valid XML blocks—whether you're defining views, menus, actions, buttons, or templates.

Each snippet is optimized to follow Odoo’s best practices and is fully compatible with the VS Code editor. In this section, you’ll find the complete list of supported XML snippet keywords, designed to speed up your UI development while keeping your code clean and consistent.

Each snippet is optimized to follow Odoo’s best practices and is fully compatible with the VS Code editor. In this section, you’ll find the complete list of supported XML snippet keywords, designed to speed up your UI development while keeping your code clean and consistent.

XML View Snippets

* odoo object button – Add a button that calls a server method:
<button name="method_name" string="Button Text" type="object" class="btn-primary"/>
* odoo action button – Add a button that triggers a client-side action:
<button name="%(action_name)d" string="Button Text" type="action" class="btn-primary"/>
* odoo smart button – Add a smart button with statistical info:
<button name="action_view_records" type="object" class="oe_stat_button" icon="fa-list">
   <field name="record_count" widget="statinfo" string="Records"/>
</button>
* odoo button box – Add button box:
<div class="oe_button_box" name="button_box">
   <!-- Add smart buttons here -->
</div>
* odoo xpath – Modify inherited views using xpath:
<xpath expr="//field[@name='field_name']" position="after">
   <!-- Add your content here -->
</xpath>
* odoo page – Define a notebook page inside a form view:
<page string="Page Title" name="page_name">
   <!-- Add your page content here -->
</page>
* odoo sheet – Structure form fields inside a sheet:
<sheet>
   <group>
       <field name="field_name"/>
       <!-- Add more fields here -->
   </group>
</sheet>
* odoo header – Add buttons/statusbar in the form header:
<header>
   <button name="action_confirm" string="Confirm" type="object" states="draft" class="btn-primary"/>
   <button name="action_cancel" string="Cancel" type="object" states="confirmed"/>
   <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done"/>
</header>
* odoo xml – Root tag for XML definition files:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
   <!-- Enter your Odoo XML code here -->
</odoo>
* Odoo field – Add a Field to the View
<field name="field_name"/>
* Odoo label – Add a Label
<label for="field_name" string="Label Text" class="o_form_label"/>
* odoo notebook – Add Notebook Block
<notebook>
   <page string="Page Title" name="page_name">
       <!-- Add your page content here -->
   </page>
</notebook>
* odoo record – Add record tag
<record id="record_id" model="model.name">
   <field name="field_name">value</field>
   <!-- Add more <field> tags here -->
</record>

XML Field Attributes

* odoo domain – Add domain (filter condition) to a field:

domain="[('field_name', '=', value)]"

* odoo options – Specify options like currency fields:

options="{'option_name': option_value}"

* odoo groups – Restrict field visibility based on groups:

groups="base.group_user"

* odoo field widget – Apply a widget to a field:

<field name="field_name" widget="many2many_tags"/>

* odoo field invisible – Set conditions to hide field:

<field name="field_name" invisible="True"/>

* odoo field readonly – Make field readonly under condition:

<field name="field_name" readonly="True"/>

* odoo field required – Make field required dynamically:

<field name="field_name" required="True"/>

Menu Items and Actions

* odoo menu root – Create a root-level menu:

<menuitem id="menu_root_name"
   name="Root Menu Name"
   web_icon="module_name,static/description/icon.png"
   sequence="10"/>

* odoo menu category – Create a submenu or category:

<menuitem id="menu_category_name"
   name="Category Name"
   sequence="10"/>

* odoo menu action – Attach an action to a menu item:

<menuitem id="menu_menu_name"
   name="Menu Name"
   action="action_name"
   parent="parent_menu"
   sequence="10"/>

* odoo action – Define a basic action window:

<record id="action_model_name" model="ir.actions.act_window">
   <field name="name">Action Name</field>
   <field name="res_model">model.name</field>
   <field name="view_mode">list,form</field>
   <field name="help" type="html">
       <p class="o_view_nocontent_smiling_face">
           Create your first record!
       </p>
   </field>
</record>

View Types/Templates

* odoo form view – Create Form View Template

<record id="model_name_view_form" model="ir.ui.view">
   <field name="name">model.name.view.form</field>
   <field name="model">model.name</field>
   <field name="arch" type="xml">
       <form string="Form Title">
           <sheet>
               <group>
                   <field name="name"/>
                   <!-- Add your fields here -->
               </group>
           </sheet>
       </form>
   </field>
</record>

* odoo list view – Create List View Template

<record id="model_name_view_list" model="ir.ui.view">
   <field name="name">model.name.view.list</field>
   <field name="model">model.name</field>
   <field name="arch" type="xml">
       <list string="List Title">
           <field name="name"/>
           <!-- Add your fields here -->
       </list>
   </field>
</record>

* odoo search view – Create Search View Template

<record id="model_name_view_search" model="ir.ui.view">
   <field name="name">model.name.view.search</field>
   <field name="model">model.name</field>
   <field name="arch" type="xml">
       <search string="Search Title">
           <field name="name"/>
           <!-- Add your fields here -->
           <filter string="Filter Name" name="filter_name" domain="[('field', '=', value)]"/>
           <group expand="0" string="Group By">
               <filter string="Group By Name" name="group_by_name" context="{'group_by': 'field'}"/>
           </group>
       </search>
   </field>
</record>

* odoo kanban – Create Kanban View Template

<record id="model_name_view_kanban" model="ir.ui.view">
   <field name="name">model.name.view.kanban</field>
   <field name="model">model.name</field>
   <field name="arch" type="xml">
       <kanban string="Kanban Title" class="o_kanban_small_column">
           <field name="name"/>
           <!-- Add your fields here -->
           <templates>
               <t t-name="kanban-box">
                   <div class="oe_kanban_global_click">
                       <div class="oe_kanban_details">
                           <strong class="o_kanban_record_title">
                               <field name="name"/>
                           </strong>
                       </div>
                   </div>
               </t>
           </templates>
       </kanban>
   </field>
</record>

* odoo pivot view – Create Pivot View Template

<record id="model_name_view_pivot" model="ir.ui.view">
   <field name="name">model.name.view.pivot</field>
   <field name="model">model.name</field>
   <field name="arch" type="xml">
       <pivot string="Pivot Title">
           <field name="field_name"/>
           <field name="field_name"/>
           <field name="field_name"/>
       </pivot>
   </field>
</record>

* odoo calendar view – Create Calendar View Template

<record id="model_name_view_calendar" model="ir.ui.view">
   <field name="name">model.name.view.calendar</field>
   <field name="model">model.name</field>
   <field name="arch" type="xml">
       <calendar string="Calendar Title" date_start="start_date_field" date_stop="end_date_field" mode="month">
           <field name="name"/>
           <!-- Add your fields here -->
       </calendar>
   </field>
</record>

* odoo view inherit – Inherit and extend an existing view:

<record id="model_name_view_view_type_inherit" model="ir.ui.view">
   <field name="name">model.name.inherit.view_type</field>
   <field name="model">model.name</field>
   <field name="inherit_id" ref="module.view_id"/>
   <field name="arch" type="xml">
       <!-- Add your xpath modifications here -->
   </field>
</record>

Conclusion

Odoo's XML architecture is powerful but often repetitive, especially when setting up views, forms, actions, and menus. Manually writing these structures can slow down development and lead to small but frustrating mistakes.

With Cybrosys Assista – Odoo Helper for VS Code, you can skip the boilerplate and insert clean, ready-to-use XML blocks in seconds. Whether you're defining smart buttons, organizing forms with notebooks, or adding chatter functionality, the extension’s XML snippet keywords help you maintain both speed and consistency throughout your workflow.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message