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

Assista Odoo Helper for Pycharm - XML Keywords

Technical XML keywords Pycharm Cybrosys Assista

In Odoo, XML plays a central role in defining views, actions, menus, and the overall structure of the user interface. Writing XML manually can be time-consuming and error-prone, especially when dealing with repeated patterns like form layouts, list views, button definitions, and menu hierarchies.

Cybrosys Assista – Odoo Helper for PyCharm simplifies this process by offering a powerful set of XML snippet keywords. These shortcuts allow developers to instantly insert clean, well-structured XML code directly into their PyCharm editor, saving time and reducing mistakes.

This section covers all supported XML snippet keywords in the plugin, including view templates, field attributes, menu definitions, and action windows. With these snippets, you can focus on building features instead of retyping boilerplate XML.

XML View Snippets

* odoo_btn_object – Add a button that calls a server method:

 <button name="button_method_name" type="object" string="Button Label" class="btn-primary"/>

* odoo_btn_action – Add a button that triggers a client-side action:

<button name="%(action_id)d" type="action" string="Action Button" class="btn-secondary"/>

* odoo_button_smart – Add a smart button with statistical info:

<button name="Button Action" class="oe_stat_button" icon="fa-bars" type="object">
    <div class="o_stat_info">
        <field name="some_field" class="o_stat_value"/>
        <span class="o_stat_text">Label</span>
    </div>
</button>
* odoo_button_box – Add button box:
<div class="oe_button_box" name="button_box">
    <button name="Button Action"
            class="oe_stat_button"
            icon="fa-bars"
            type="object"
            invisible=""
            groups="">
        <div class="o_stat_info">
            <field name="" class="o_stat_value"/>
            <span class="o_stat_text"></span>
        </div>
    </button>
</div>
* odoo_xpath – Modify inherited views using xpath:
<xpath expr="//field[@name='name']" position="after">
    <field name="new_field"/>
</xpath>

* odoo_page – Define a notebook page inside a form view:

<page string="Details">
    <field name="field_name"/>
</page>

* odoo_sheet – Structure form fields inside a sheet:

<sheet>
    <group>
        <field name="name"/>
        <field name="description"/>
    </group>
</sheet>

* odoo_header – Add buttons/statusbar in the form header:

<header>
    <button name="action_confirm" type="object" string="Confirm" class="oe_highlight"/>
    <field name="state" widget="statusbar" statusbar_visible="draft,done" statusbar_colors="{'draft':'blue','done':'green'}"/>
</header>

* odoo_tag – Root tag for XML definition files:

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <!-- All your records go here -->
</odoo>
* odoo_field – Add a Field to the View
<field name="field_name" string="Field Label" required="True"/>

* odoo_label – Add a Label

<label for="field_name" string="Label Text"/>

* odoo_separator – Add a Section Separator

<separator string="Section Title"/>

* odoo_chatter – Add Chatter in Form

<chatter/>

* odoo_notebook – Add Notebook Block

<notebook>
    <page string="New Page">
        <!-- Page content goes here -->
    </page>
</notebook>

* Odoo_record – Add record tag

<record id="" model="">
</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="{'currency_field': 'currency_id'}"

* odoo_groups – Restrict field visibility based on groups:

groups="base.group_user"

* odoo_field_widget – Apply a widget to a field:

widget="monetary"

* odoo_field_invisible – Set conditions to hide field:

invisible="state != 'done'"

* odoo_field_readonly – Make field readonly under condition:

readonly="not can_edit"

* odoo_field_required – Make field required dynamically:

required="action == 'exist'"

Menu Items and Actions

* odoo_menu_item_root – Create a root-level menu:

<menuitem id="menu_root_id" name="Main Menu"/>

* odoo_menu_item_categ – Create a submenu or category:

<menuitem id="menu_sub_id" name="Submenu" parent="menu_root_id"/>

* odoo_menu_item_action – Attach an action to a menu item:

<menuitem id="menu_action_id" name="Open Model" parent="menu_sub_id" action="action_model_id"/>

* odoo_action – Define a basic action window:

<record id="action_model_id" model="ir.actions.act_window">
    <field name="name">Model Action</field>
    <field name="res_model">model.name</field>
    <field name="view_mode">list,form</field>
    <field name="context">{}</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"/>
                    <field name="description"/>
                </group>
            </sheet>
        </form>
    </field>
</record>

* odoo_list_view – Create List (tree) 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 View">
            <field name="name"/>
            <field name="date"/>
        </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">
            <field name="name" string="Name"/>
            <filter string="Draft" name="draft"       domain="[('state','=','draft')]"/>
        </search>
    </field>
</record>
* odoo_kanban – Create Kanban View Template
<kanban class="o_kanban_example">
    <field name="name"/>
    <templates>
        <t t-name="kanban-box">
            <div class="oe_kanban_global_click">
                <strong><field name="name"/></strong>
                <div><field name="description"/></div>
            </div>
        </t>
    </templates>
</kanban>
* 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="Model Name Pivot">
            <field name="name"/>
            <field name="state"/>
        </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="Model Calendar" date_start="date">
            <field name="name"/>
            <field name="state"/>
        </calendar>
    </field>
</record>
* odoo_inherit_view – Inherit and extend an existing view:
 <record id="model_name_view_type_view_inherit" model="ir.ui.view">
    <field name="name">model.name.view.type.view.inherit</field>
    <field name="model">model.name</field>
    <field name="inherit_id" ref="module.original_form_view_id"/>
    <field name="arch" type="xml">
        <xpath expr="//group[1]" position="inside">
            <field name="new_field1"/>
            <field name="new_field2"/>
        </xpath>
    </field>
</record>

Conclusion

Odoo's XML architecture is powerful but often repetitive, especially when you're setting up views, forms, actions, and menus. Writing these structures manually can slow down development and introduce small but costly errors.

With Cybrosys Assista – Odoo Helper for PyCharm, you can skip the boilerplate and insert well-structured, ready-to-use XML blocks in seconds. Whether you're defining a smart button box, organizing a form with notebooks, or attaching chatter functionality, the plugin’s XML snippet keywords help you maintain consistency and speed 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