Odoo Help


How do you override a field label in an XML view?

Jeff Beidler
on 9/15/14, 5:27 PM 10,518 views

I inherited a view and added some new (existing) fields to a list, but I would like to change the default labels for these fields because they are too long.  I tried adding _<label for="product_name" string="Product Name"/>_ in my XML file, but this causes the server to throw an Invalid XML Architecture error. Is it a problem with the syntax of the _<label>_ tag, or do I have to use the _<xpath>_ element?

          <field name="arch" type="xml">
                        <field name="name" position="after">
                            <field name="product_name" string="Product Name"/>
                            <!--<label for="product_name" string="Product Name"/>-->
                            <field name="product_code"/>

Could you post the whole code block? What are you trying to accomplish with the

Alex Gallien
on 9/15/14, 5:33 PM

The label tag that is.

Alex Gallien
on 9/15/14, 5:33 PM

I posted the "arch" bit. The default label for "product_name" is "Supplier Product Name". I was trying to shorten that with the label tag to either "Product Name" or simply, "Name".

Jeff Beidler
on 9/15/14, 5:45 PM

Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 9/15/14, 11:22 PM

You just need to change the string attribute of the field in the XML.

If product_name is the field you are trying to change, simply write this:

<field name="arch" type="xml">
        <field name="product_name" position="attributes">
                <attribute name="string">New Field Label</attribute>

Then, start another <field></field> block for the fields you want to add.

Thanks, Ray! Great tip! I knew it must be possible to do in the view XML!

Jeff Beidler
on 9/16/14, 12:13 PM
Alex Gallien
On 9/15/14, 5:48 PM

Try inheriting the class product_supplierinfo and overriding the 'product_name' column by turing this:

        'product_name': fields.char('Supplier Product Name', size=128, help="This supplier's product name will be used when printing a request for quotation. Keep empty to use the internal one.")


        'product_name': fields.char('Product Name', size=128, help="This supplier's product name will be used when printing a request for quotation. Keep empty to use the internal one.")

Yeah, I thought about that. I just thought it might also be possible from the XML view definition. It's just a text string for display, after all! Thanks again! I'll try out your answer.

Jeff Beidler
on 9/15/14, 5:58 PM

Overriding the field in Python code works. :)

Jeff Beidler
on 9/15/14, 6:43 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 9/15/14, 5:27 PM
Seen: 10518 times
Last updated: 8/29/16, 5:44 AM