Skip to Content
Menu
This question has been flagged
1 Odpoveď
1815 Zobrazenia

I need to disable price_unit if standard_price != 0 or profit_rate !=0.

My view:



model="ir.ui.view" id="sale_order_view_inherit">
name="name">sale.order.view.inherit1
name="model">sale.order
name="inherit_id" ref="sale.view_order_form"/>
name="arch" type="xml">
expr="/form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='name']" position="after">
name="standard_price"/>
name="profit_rate" widget="percentage"/>

expr="/form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_unit']" position="replace">
name="price_unit" attrs="{'readonly': ['|', ('qty_invoiced', '>', 0), ('profit_rate', '!=', 0), ('standard_price', '!=', 0)]}"/>






But price_unit is disabled only when both standard_price != 0 and profit_rate !=0. Please help!

Avatar
Zrušiť
Best Answer

Hi,

You have missed one OR operator, update the code as follows:

attrs="{'readonly': ['|', '|', ('qty_invoiced', '>', 0), ('profit_rate', '!=', 0), ('standard_price', '!=', 0)]}"


Thanks

Avatar
Zrušiť