Odoo Help

Welcome!

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.

2

How to change string label of fields based on condition?

By
Anirudh Lou
on 5/18/15, 5:59 AM 1,034 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':

self.write(cr,uid,ids,{

                               '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.

1

Omal Bastin

--Omal Bastin--
1146
| 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)]}"/>

</div>

<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 Lorinc
on 12/30/15, 9:32 AM
0

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
996
| 5 3 6
Rajkot, 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.

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

1 follower(s)

Stats

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