Test actual quantity against None for processed quantity in Blanket Agreement

Closes #13865
(grafted from 93394d850038adab243cd1f10c6f20b9732ca23a)

--HG--
branch : 7.0
This commit is contained in:
Maxime Richez committed 2025-02-11 13:32:57 +01:00
1 parent 5750f69a6c
commit 68c9d8e76b
4 files changed
+16 -8

No files matched your search

@@ -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
+4 -1
View File
@@ -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)
+4 -3
View File
@@ -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
+4 -1
View File
@@ -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)