Odoo Help


How to change string label of fields based on condition?

Anirudh Lou
on 5/18/15, 5:59 AM 2,780 views

Hi to all. Is it possible to change string label base on condition? I have function that will return something but before it return an object i want to change label of some fields kindd this one:

if state == 'approved':


                               'temp_holder' : uid,

                               #but at the same time, i want to change the string label of temp_holder just like this: Approved by              


Any help is very much appreciated.


Omal Bastin

--Omal Bastin--

| 6 6 8
Kochi, Kerala, India
--Omal Bastin--

Swiming deep into openERP/ODOO

Omal Bastin
On 12/3/15, 7:42 AM

What you can do is add labels.

<div >

<label for="name" attrs="{'invisible': ['condition','=',False)]}"/>

<label for="name" string="Custom String" attrs="{'invisible': [('condition','=',True)]}"/>


<field name="name" nolabel="1" />

only problem is that it will not have a vertical separator between label and field value.

Yes, it doesn't look exceptionally good, but it works.

Aron Lorincz
on 12/30/15, 9:32 AM

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--

| 6 5 6
Baroda, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 12/30/15, 8:57 AM

Dear Anirudh Loh,

Please refer def fields_view_get method, Using that you can achieve your goal.

Best Regards,

Ankit H Gandhi.

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

1 follower(s)


Asked: 5/18/15, 5:59 AM
Seen: 2780 times
Last updated: 12/30/15, 8:57 AM