diff --git a/modules/purchase_trade/pricing.py b/modules/purchase_trade/pricing.py index 94618be..dc082a6 100755 --- a/modules/purchase_trade/pricing.py +++ b/modules/purchase_trade/pricing.py @@ -707,12 +707,24 @@ class Component(ModelSQL, ModelView): fix_type = fields.Many2One('price.fixtype',"Fixation type") ratio = fields.Numeric("%",digits=(16,7)) - price_index = fields.Many2One('price.price',"Curve") - price_matrix = fields.Many2One('price.matrix', "Price Matrix") + price_index = fields.Many2One( + 'price.price', "Curve", + states={ + 'readonly': Eval('price_source_type') != 'curve', + 'required': Eval('price_source_type') == 'curve', + }, + depends=['price_source_type']) + price_matrix = fields.Many2One( + 'price.matrix', "Price Matrix", + states={ + 'readonly': Eval('price_source_type') != 'matrix', + 'required': Eval('price_source_type') == 'matrix', + }, + depends=['price_source_type']) fixed_price = fields.Numeric( "Fixed Price", digits=(16, 6), states={ - 'invisible': Eval('price_source_type') != 'fixed', + 'readonly': Eval('price_source_type') != 'fixed', 'required': Eval('price_source_type') == 'fixed', }, depends=['price_source_type']) diff --git a/modules/purchase_trade/view/component_form.xml b/modules/purchase_trade/view/component_form.xml index 1aa2d78..0410909 100755 --- a/modules/purchase_trade/view/component_form.xml +++ b/modules/purchase_trade/view/component_form.xml @@ -7,12 +7,12 @@