Reputation: 193
Without speaking a lot this is the piece of code I'm working on :
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<form string="Sales Order" version="7.0">
<!-- some codes -->
<field name="order_line">
<tree string="Sales Order Lines" editable="bottom" colors = "red:price_unit < 10.0">
<!-- some fields -->
<field name="price_unit"/>
<field name="discount"/>
<field name="price_subtotal"/>
</tree>
</field>
</form>
</field>
</record>
What i want is : coloring sales order line with red colors if the unit_price < 10.0 as you see in the code i express it like that : <tree ... colors="red:unit_price < 10.0">
, But when I test it to see the result, It doesn't work.
Do you have guys any idea why it doesn't work, or someone has a suggestion to reach that result with a different way; maybe by using JS.
Upvotes: 0
Views: 96
Reputation: 2825
Instead of using color attribute, use decoration-{danger/info/..}
attribute. Also, use <
or >
inside xml for <
or >
.
<tree string="Sales Order Lines" editable="bottom" decoration-danger="price_unit < 10">
This answer is applicable for newer versions of Odoo (10 or later)
Upvotes: 1