Odoo Help


This community 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.


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

Jeff Beidler
on 9/15/14, 5:27 PM 4,969 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
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

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. 

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)


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