From a69a9dcb575ad565524a721b126453749ae4948b Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Wed, 4 Feb 2026 21:20:34 +0100 Subject: [PATCH] 04.02.26 --- modules/lot/lot.py | 11 ++++++----- modules/purchase/purchase.py | 6 +++--- modules/purchase_trade/fee.py | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/lot/lot.py b/modules/lot/lot.py index 043ac27..60858b9 100755 --- a/modules/lot/lot.py +++ b/modules/lot/lot.py @@ -503,9 +503,9 @@ class Lot(ModelSQL, ModelView): physic_sum += round(Decimal(Uom.compute_qty(Uom(l.lot_unit_line),float(l.get_current_quantity()),l.line.unit)),5) return line.quantity_theorical - physic_sum - def get_current_quantity(self,state_id=0,name=None): + def get_current_quantity(self,name=None): # if self.lot_type == 'physic': - qt, gross_qt = self.get_hist_quantity(state_id) + qt, gross_qt = self.get_hist_quantity() return qt # else: # return self.get_virtual_diff() @@ -513,11 +513,12 @@ class Lot(ModelSQL, ModelView): def get_current_quantity_converted(self,state_id=0,name=None): Uom = Pool().get('product.uom') unit = self.line.unit if self.line else self.sale_line.unit - return round(Decimal(Uom.compute_qty(self.lot_unit_line, float(self.get_current_quantity(state_id)), unit)),5) + 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(self,state_id=0,name=None): + def get_current_gross_quantity(self,name=None): if self.lot_type == 'physic': - qt, gross_qt = self.get_hist_quantity(state_id) + qt, gross_qt = self.get_hist_quantity() return gross_qt else: return None diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index b742b7a..57ab2fd 100755 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1931,12 +1931,12 @@ class Line(sequence_ordered(), ModelSQL, ModelView): elif fee[0].mode == 'ppack': invoice_line.quantity = fee[0].quantity else: - seq = 0 + state_id = 0 LotQtType = Pool().get('lot.qt.type') lqt = LotQtType.search([('name','=','BL')]) if lqt: - seq = lqt[0].sequence - invoice_line.quantity = fee[0].get_fee_lots_qt(seq) + state_id = lqt[0].id + invoice_line.quantity = fee[0].get_fee_lots_qt(state_id) lines.append(invoice_line) logger.info("GETINVLINE:%s",self.product.type) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index 45f129a..3f89cd0 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -334,12 +334,12 @@ class Fee(ModelSQL,ModelView): return super().copy(fees, default=default) - def get_fee_lots_qt(self,seq=0): + def get_fee_lots_qt(self,state_id=0): qt = Decimal(0) FeeLots = Pool().get('fee.lots') fee_lots = FeeLots.search([('fee', '=', self.id)]) if fee_lots: - qt = sum([e.lot.get_current_quantity_converted(seq) for e in fee_lots]) + qt = sum([e.lot.get_current_quantity_converted(state_id) for e in fee_lots]) logger.info("GET_FEE_LOTS_QT:%s",qt) return qt