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

Closes #13593
(grafted from 203c7f14ff6c4b230fe9bc0de42052d4b8cf90cb)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2024-10-27 19:41:19 +01:00
1 parent 14166e9966
commit 03c04ec1c9
2 files changed
+12 -6

No files matched your search

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