Daniel Reis
Daniel Reis

Reputation: 13382

Change the content of a record field from an XML file

In OpenERP XML fields are used to load module data. The <record> tag is used for this. When reinstalling the module, the records are rewritten with the current data in the XML file.

But is there a way to change just one of the record fields without rewriting all the others?

For instance, in addons/project_issue/project_issue_view.xml we have this action definition:

    <record id="project_issue_categ_action" model="ir.actions.act_window">
        <field name="name">Issue Categories</field>
        <field name="res_model">crm.case.categ</field>
        <field name="view_type">form</field>
        <field name="view_id" ref="crm.crm_case_categ_tree-view"/>
        <field name="domain">[('object_id.model', '=', 'project.issue')]</field>
        <field name="context" eval="{'object_id': ref('model_project_issue')}"/>
    </record>

Is it possible to change just the name field in an XML file of a custom module?

I already tried :

    <record id="project_issue.project_issue_categ_action" model="ir.actions.act_window">
        <field name="name">Issue Categorization</field>
    </record>

and

    <update id="project_issue.project_issue_categ_action" model="ir.actions.act_window">
        <field name="name">Issue Categorization</field>
    </update>

Upvotes: 2

Views: 312

Answers (1)

Sudhir Arya
Sudhir Arya

Reputation: 3743

<record id="project_issue.project_issue_categ_action" model="ir.actions.act_window">
    <field name="name">Issue Categorization</field>
</record>

Your given code will change the name but won't affect menu name. You can see your given action name in form and tree view. To change menu name, you have to override menu only not action.

For example:

<record id="project_issue.menu_project_issue_category_act" model="ir.ui.menu">
    <field name="name">Issue Categorization</field>
</record>

You can even refer Apply groups on already created menus

Upvotes: 2

Related Questions