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 change the string on an inherited field in a class? (I know how to override in view, but want all instances changed)

John Baldwin
on 1/22/15, 10:41 PM 452 views

According to read-the-docs at https://media.readthedocs.org/pdf/odoo-new-api-guide-line/latest/odoo-new-api-guide-line.pdf :

One of the new features of the API is to be able to change only one attribute of the field:

name = fields.Char(string=’New Value’)


So i do this in my_res_partner.py:

class my_res_partner(models.Model):

    _inherit = 'res.partner'

    is_company = fields.Boolean(string='Company')



Hardikgiri Goswami

--Hardikgiri Goswami--
| 2 1 5
Rajkot, India
--Hardikgiri Goswami--

OpenERP/Odoo Customization/Integration Expert / Python Programmer

Skype ID : hardikgiri.goswami

Hardikgiri Goswami
On 1/23/15, 12:07 AM

Hello John,

There are many ways to apply the string for a field.

The string for "is_company" is applied from the xml file from the view side. You can search in xml like "Is a Company?"

You metioned you want to change string of "is_company" right ?

Thanks for answering Hardikgiri. I want to be able to override the string in my inherited model inside my class, not in the xml view. My reason is that you are supposed to be able to do that and I would like to know how to do it properly in the new API. I already know I can do it in individual views and is_company really only shows up in one view but I would like to be able to do it in a module so that other fields that I use in multiple views can have their sting changed in the one file not multiple files. Do you understand?

John Baldwin
on 1/23/15, 12:29 AM

Sorry, now I see what you are saying, in the ORIGINAL res.partner view the string is defined inside the label tag! That's why I can't get it to override! Thanks! I completely overlooked that.

John Baldwin
on 1/23/15, 12:33 AM
John Baldwin
On 1/23/15, 4:45 AM

Field inheritance is still not working for me! I've tried it again and can't figure it out. See:

for my detailed experience and frustration with this problem. Hardikgiri's advice for xml views containing string overrides was helpful in that instance but in the link above you will see that I'm not dealing with that; just pure fied inheritance and it's buggy. Please help if you can.

It was acting buggy because I did not import my .py file in init but had imported other where it was working... DOH!

John Baldwin
on 1/30/15, 10:52 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

2 follower(s)


Asked: 1/22/15, 10:41 PM
Seen: 452 times
Last updated: 3/16/15, 8:10 AM