Skip to Content
Menu
This question has been flagged
3 Replies
13833 Views

Hi,

I was trying to change filed name of employee form by

Technical -> Database -> Models

but when I try to do changes in that it is giving me following error

"Properties of base fields cannot be altered in this manner! Please modify them through Python code, preferably through a custom addon!"

So then I tried to change label through python code but it is not showing any output ( no replacement of any label )   


please help me to solve this issue. Just want the solutions regarding how to change label (String) of any field


Thanks in Advance! 

Avatar
Discard
Best Answer

Hi Sushrutha,
There are three ways you can do it,

    1. Activate developer mode, open the view you want to edit the label, then click the bug icon on the to panel, then click Edit View : Form/Tree depending on the view you want to modify.Then go to the architecture tab, find your field name in XML and modify it as: 


<field name="field_name" string="Your String here"/>

    2.The next option is to change the string attribute using a custom module you may use the below code for reference:


<xpath expr="//field[@name='field_name']" position="attributes">
    <attribute name="string">Your String Here</attribute>
</xpath>

3. You may override the field as below:


class ModelName(models.Model):
    _inherit = 'model.name'

    field_name = fields.FieldType(string="Your String Here")

Hope this answer help you...

Regards

Cybrosys

Avatar
Discard
Best Answer

Hello,

i tried the 3rd solution because i need to change the string for all views but it change only the value for language en_US but not for the 2nd language installed : fr_Fr

How can i do this ?

Avatar
Discard
Best Answer

You can do this without writing a module, just create your own View that inherits and overrides the base View:

https://www.odoo.com/forum/help-1/question/change-string-placeholder-text-with-view-inheritance-83801

Avatar
Discard