Skip to Content
Menu
This question has been flagged
1 Reply
1752 Views
Can the _descricpion field be different for multiple views using the same model?
Avatar
Discard
Best Answer

Hi

In Odoo, the _description field is a special field used to define the description or label for a model. This field is used to provide a human-readable name for the model and is typically displayed in various places throughout the Odoo user interface. By default, the _description field is static and remains the same for all views using the same model. This means that regardless of the view you are using, the description will be consistent.

To achieve this, you can create a new view for the model and specify the desired value for the _description field within that view. When the view is used, the overridden description will be displayed instead of the default one.

Here's an example of how you can define a custom description for a specific view in Odoo XML:

<record id="custom_view_id" model="ir.ui.view">
 
  <field name="name">Custom View</field>
<field name="model">your.model</field>
    <field name="inherit_id" ref="base.view_form"/>
    <field name="arch" type="xml">
        <field name="_description" position="attributes">
            <attribute name="string">Custom Description</attribute>
        </field>
    </field>
</record>


Hope it helps

Avatar
Discard