diff --git a/modules/purchase_blanket_agreement/purchase.py b/modules/purchase_blanket_agreement/purchase.py index 287f9afd73..4e89bc3b6c 100644 --- a/modules/purchase_blanket_agreement/purchase.py +++ b/modules/purchase_blanket_agreement/purchase.py @@ -821,9 +821,10 @@ class Line(metaclass=PoolMeta): pool = Pool() Uom = pool.get('product.uom') if self.unit.category == line.unit.category: - return Uom.compute_qty( - self.unit, (self.actual_quantity or self.quantity), line.unit, - round=round) + quantity = ( + self.actual_quantity if self.actual_quantity is not None + else self.quantity) + return Uom.compute_qty(self.unit, quantity, line.unit, round=round) return 0 diff --git a/modules/purchase_secondary_unit/purchase.py b/modules/purchase_secondary_unit/purchase.py index 2b872823b7..2af6aea180 100644 --- a/modules/purchase_secondary_unit/purchase.py +++ b/modules/purchase_secondary_unit/purchase.py @@ -351,8 +351,11 @@ class LineBlanketAgreement(metaclass=PoolMeta): quantity = super().quantity_for_blanket_agreement(line, round=round) if (self.secondary_unit and self.secondary_unit.category == line.unit.category): + purchase_line_quantity = ( + self.actual_quantity if self.actual_quantity is not None + else self.quantity) quantity = Uom.compute_qty( - self.unit, (self.actual_quantity or self.quantity), line.unit, + self.unit, purchase_line_quantity, line.unit, factor=self.secondary_uom_factor, rate=self.secondary_uom_rate, round=round) diff --git a/modules/sale_blanket_agreement/sale.py b/modules/sale_blanket_agreement/sale.py index 2e2cd54885..679e1edafa 100644 --- a/modules/sale_blanket_agreement/sale.py +++ b/modules/sale_blanket_agreement/sale.py @@ -757,9 +757,10 @@ class Line(metaclass=PoolMeta): pool = Pool() Uom = pool.get('product.uom') if self.unit.category == line.unit.category: - return Uom.compute_qty( - self.unit, (self.actual_quantity or self.quantity), line.unit, - round=round) + quantity = ( + self.actual_quantity if self.actual_quantity is not None + else self.quantity) + return Uom.compute_qty(self.unit, quantity, line.unit, round=round) return 0 diff --git a/modules/sale_secondary_unit/sale.py b/modules/sale_secondary_unit/sale.py index 2b23e15231..b0cf864f4e 100644 --- a/modules/sale_secondary_unit/sale.py +++ b/modules/sale_secondary_unit/sale.py @@ -300,8 +300,11 @@ class LineBlanketAgreement(metaclass=PoolMeta): quantity = super().quantity_for_blanket_agreement(line, round=round) if (self.secondary_unit and self.secondary_unit.category == line.unit.category): + sale_line_quantity = ( + self.actual_quantity if self.actual_quantity is not None + else self.quantity) quantity = Uom.compute_qty( - self.unit, (self.actual_quantity or self.quantity), line.unit, + self.unit, sale_line_quantity, line.unit, factor=self.secondary_uom_factor, rate=self.secondary_uom_rate, round=round)