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

Closes #13593
(grafted from 203c7f14ff6c4b230fe9bc0de42052d4b8cf90cb)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2024-10-27 19:41:19 +01:00
1 parent 1798e57775
commit 7c28af4bd5
2 files changed
+12 -6

No files matched your search

+6 -3
View File
@@ -1773,9 +1773,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
@@ -1803,9 +1803,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):