diff --git a/modules/lot/lot.py b/modules/lot/lot.py index 606bce4..69ae16f 100755 --- a/modules/lot/lot.py +++ b/modules/lot/lot.py @@ -500,7 +500,12 @@ class Lot(ModelSQL, ModelView): physic_sum = Decimal(0) for l in line.lots: if l.lot_type == 'physic' : - physic_sum += round(Decimal(Uom.compute_qty(Uom(l.lot_unit_line),float(l.get_current_quantity()),l.line.unit, True, 1, 1)),5) + factor = None + rate = None + if l.lot_unit_line.category.id != l.line.unit.category.id: + factor = 1 + rate = 1 + physic_sum += round(Decimal(Uom.compute_qty(Uom(l.lot_unit_line),float(l.get_current_quantity()),l.line.unit, True, factor, rate)),5) return line.quantity_theorical - physic_sum def get_current_quantity(self,name=None): @@ -515,14 +520,24 @@ class Lot(ModelSQL, ModelView): 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, True, 1, 1)),5) + factor = None + rate = None + if self.lot_unit_line.category.id != unit.category.id: + factor = 1 + rate = 1 + return round(Decimal(Uom.compute_qty(self.lot_unit_line, float(qt), unit, True, factor, rate)),5) def get_current_gross_quantity_converted(self,state_id=0,unit=None): Uom = Pool().get('product.uom') 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, True, 1, 1)),5) + factor = None + rate = None + if self.lot_unit_line.category.id != unit.category.id: + factor = 1 + rate = 1 + return round(Decimal(Uom.compute_qty(self.lot_unit_line, float(gross_qt), unit, True, factor, rate)),5) def get_current_gross_quantity(self,name=None): if self.lot_type == 'physic':