Odoo Help


How can I change the look of an field in the products tree view?

Stefan Reisich
on 3/1/13, 10:10 AM 1,630 views

I have created a new field special_price in products view. Now I want create a module that changes the look of the product tree view so that the price column looks like this: 119,00 100,00 (normal price special price). But only if the product has a special price.

How can I do that?

Thank you very much.


Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--

| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 3/2/13, 8:47 AM


see first this url (sorry I not enough Karma to add complete url :( ):

h t t p : / / en.wikipedia.org/wiki/Strikethrough

to test :

create a new field type char normal_price_char with same string than normal_price ((to display the same name in view).

add it to the tree view and do invisible field normal_price in this same tree view.

in the form view, for fields normal_price and extra_price add the same attribute on_change function named by example onchange_normal_price_char with in body function this 2 fields.

in python class create the onchange function onchange_normal_price_char.

in onchange function, add test: if extra_price:

normal_price_char_temp = str(normal_price) (convert integer to string)

add in this condition a function which custom normal_price_char_temp with character "-" betweeen each char number (example : 1234 become 1-2-3-4).

use function attribute encode() with unicode U+0336 normal_price_char = normal_price_char_temp.encode('U+0336') (I hope this unicode will be known else search how to write this unicode correctly if this doesn't work)

else: normal_price_char = str(normal_price)

return {'value'{normal_price_char ': normal_price_char}}

perhaps you should do some personnal customs...

Hope this will help and work.

Don't forget to post your module to the openerp apps if it works ;)


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: 3/1/13, 10:10 AM
Seen: 1630 times
Last updated: 3/16/15, 8:10 AM