Round moved quantity before compare to 0

As moved quantity is the sum of float, it may carry rounding issue so it must
be rounded before comparison.

Closes #14386
This commit is contained in:
Cédric Krier
2025-11-25 18:38:51 +01:00
parent d0cd3e31f9
commit 93a5e6ceb8
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -2040,7 +2040,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
quantity = (
self._get_move_quantity(move_type)
- self._get_shipped_quantity(move_type))
if quantity < 0:
if self.unit.round(quantity) < 0:
warning_name = Warning.format(
'check_move_quantity', [self])
if Warning.check(warning_name):
+1 -1
View File
@@ -2167,7 +2167,7 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
quantity = (
self._get_move_quantity(move_type)
- self._get_shipped_quantity(move_type))
if quantity < 0:
if self.unit.round(quantity) < 0:
warning_name = Warning.format(
'check_move_quantity', [self])
if Warning.check(warning_name):