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:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user