跳至內容
選單
此問題已被標幟
1 回覆
1818 瀏覽次數

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!

頭像
捨棄
最佳答案

Hi,

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

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


Thanks

頭像
捨棄