Do not convert invoiced quantity if sale or purchase has not unit

Closes #13593
This commit is contained in:
Cédric Krier committed 2024-10-27 19:41:19 +01:00
1 parent 9d12fbf307
commit 0e0f5f0ec6
2 files changed
+12 -6

No files matched your search

+6 -3
View File
@@ -1917,9 +1917,12 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
if invoice_line.type != 'line':
continue
if invoice_line not in skips:
quantity += Uom.compute_qty(
invoice_line.unit or self.unit, invoice_line.quantity,
self.unit)
if self.unit:
quantity += Uom.compute_qty(
invoice_line.unit or self.unit, invoice_line.quantity,
self.unit)
else:
quantity += invoice_line.quantity
return quantity
def _get_invoice_line_moves(self):
+6 -3
View File
@@ -1954,9 +1954,12 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
if invoice_line.type != 'line':
continue
if invoice_line not in skips:
quantity += Uom.compute_qty(
invoice_line.unit or self.unit, invoice_line.quantity,
self.unit)
if self.unit:
quantity += Uom.compute_qty(
invoice_line.unit or self.unit, invoice_line.quantity,
self.unit)
else:
quantity += invoice_line.quantity
return quantity
def _get_invoice_line_moves(self):