Hi Lima:
You can display the Sales Order Lines in red color if the unit price is less than the cost by adding a custom boolean field to the Sales Order Line model and using it to change the color of the text in that row. The boolean field will compare the value of the unit price and the cost and return a True or a False as it's value which can then be used in the QWeb view.
a. Add a computed boolean field to the Sales Order Line model like so.
b. Inherit and extend the sale.view_order_form to use the value of the custom field to change the color of the rows where the unit price is less than the cost like so.
Code in Architecture field:
<data>
<xpath expr="//page[@name='order_lines']//tree[1]">
<field name="x_price_below_cost" invisible="1"/>
</xpath>
<xpath expr="//page[@name='order_lines']//tree[1]" position="attributes">
<attribute name="decoration-danger">(x_price_below_cost)</attribute>
</xpath>
</data>
The result in the Sales Order form. The cost of the first line item is $190. The entered unit price is $150 so the row is displayed in red. The cost of the second line item is $85 so it is displayed in the normal color.