Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3455 Prikazi

I want to change sale order lines colour based on selction field


py

decoration_color = fields.Selection([('red', 'red'), ('green', 'green'), ('blue', 'blue'), ('purple', 'purple')])


xml code 

expr="//sheet/notebook/page[@name='order_lines']/field[@name='order_line']/tree"
position="attributes">
name="decoration-danger">decoration_color == 'red'
name="decoration-success">decoration_color == 'green'
name="decoration-info">decoration_color == 'blue'
name="decoration-warning">decoration_color == 'purple'

 this is changing colours of description,unit price and subtotal only,all the sale order line fields are not changing

Avatar
Opusti
Best Answer

In the tree view definition (usually in the XML file), add the decoration attribute to the tree tag and set it to a domain expression that evaluates the decoration_color field. For example:

tree string="Sale Order Lines" decoration="decoration_color == 'red' ? 'red:light' : (decoration_color == 'green' ? 'green:light' : (decoration_color == 'blue' ? 'blue:light' : 'purple:light'))">
!-- Define the tree columns and fields -->
/tree>


Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
jan. 25
3231
2
avg. 24
5754
6
dec. 22
8633
1
maj 25
5859
0
mar. 24
1994