From b20b0c8df67ad016507ade340232cf3600f6c026 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Fri, 13 Mar 2026 14:47:13 +0100 Subject: [PATCH] 13.03.26 --- modules/lot/lot.py | 10 ++++++---- modules/purchase_trade/fee.py | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/lot/lot.py b/modules/lot/lot.py index 92ce710..e192ccc 100755 --- a/modules/lot/lot.py +++ b/modules/lot/lot.py @@ -510,15 +510,17 @@ class Lot(ModelSQL, ModelView): # else: # return self.get_virtual_diff() - def get_current_quantity_converted(self,state_id=0,name=None): + def get_current_quantity_converted(self,state_id=0,unit=None): Uom = Pool().get('product.uom') - unit = self.line.unit if self.line else self.sale_line.unit + if not unit: + unit = self.line.unit if self.line else self.sale_line.unit qt, gross_qt = self.get_hist_quantity(state_id) return round(Decimal(Uom.compute_qty(self.lot_unit_line, float(qt), unit)),5) - def get_current_gross_quantity_converted(self,state_id=0,name=None): + def get_current_gross_quantity_converted(self,state_id=0,unit=None): Uom = Pool().get('product.uom') - unit = self.line.unit if self.line else self.sale_line.unit + if not unit: + unit = self.line.unit if self.line else self.sale_line.unit qt, gross_qt = self.get_hist_quantity(state_id) return round(Decimal(Uom.compute_qty(self.lot_unit_line, float(gross_qt), unit)),5) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index d9d64ec..66a5f6e 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -367,7 +367,7 @@ class Fee(ModelSQL,ModelView): sm = StockMove.search(['shipment','=','stock.shipment.in,'+str(self.shipment_in.id)]) if sm: unique_lots = {e.lot for e in sm if e.lot} - return round(self.price * Decimal(sum([e.get_current_quantity_converted() for e in unique_lots])) * sign,2) + return round(self.price * Decimal(sum([e.get_current_quantity_converted(0,self.unit) for e in unique_lots])) * sign,2) LotQt = Pool().get('lot.qt') lqts = LotQt.search(['lot_shipment_in','=',self.shipment_in.id]) if lqts: @@ -415,7 +415,7 @@ class Fee(ModelSQL,ModelView): FeeLots = Pool().get('fee.lots') fee_lots = FeeLots.search([('fee', '=', self.id)]) if fee_lots: - qt = sum([e.lot.get_current_quantity_converted(state_id) for e in fee_lots]) + qt = sum([e.lot.get_current_quantity_converted(state_id,self.unit) for e in fee_lots]) logger.info("GET_FEE_LOTS_QT:%s",qt) return qt