From 0cf03a75b0de68f19e7af046a5f775bd3fccd5de Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Fri, 13 Mar 2026 10:24:54 +0100 Subject: [PATCH] 13.03.26 --- modules/purchase_trade/fee.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index e684f89..80583b6 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -66,12 +66,13 @@ class Fee(ModelSQL,ModelView): quantity = fields.Numeric("Qt",digits='unit',states={'readonly': (Eval('mode') != 'ppack') | Bool(Eval('auto_calculation'))}) unit = fields.Many2One('product.uom',"Unit",domain=[ If(Eval('mode') == 'ppack', - ('category', '=', 8), + ('category', '=', Eval('packing_category')), ()), ], states={ - 'readonly': Eval('mode') != 'ppack', + 'readonly': (Eval('mode') != 'ppack' | Eval('mode') != 'perqt'), }) + packing_category = fields.Function(fields.Integer("Packing Category"),'get_packing_category') inherit_shipment = fields.Boolean("Inh Sh",states={ 'invisible': (Eval('shipment_in')), }) @@ -109,6 +110,12 @@ class Fee(ModelSQL,ModelView): if lqt: return lqt[0].id + def get_packing_category(self, name): + UnitCategory = Pool().get('product.uom.category') + packing = UnitCategory.search(['name','=','Packing']) + if packing: + return packing[0].id + @fields.depends('line','sale_line','shipment_in','lots','price','unit','auto_calculation','mode','_parent_line.unit','_parent_line.lots','_parent_sale_line.unit','_parent_sale_line.lots') def on_change_with_quantity(self, name=None): qt = None