From 38c614af98dcc1d9703cd667c968491106ab78db Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 31 May 2026 16:19:23 +0200 Subject: [PATCH] Pricing Fixed Component --- modules/purchase_trade/pricing.py | 18 +++++++++++++++--- modules/purchase_trade/view/component_form.xml | 6 +++--- .../purchase_trade/view/component_form2.xml | 6 +++--- modules/purchase_trade/view/component_tree.xml | 4 ++-- .../view/component_tree_sequence.xml | 4 ++-- .../view/component_tree_sequence2.xml | 4 ++-- 6 files changed, 27 insertions(+), 15 deletions(-) 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 @@