Fix infinite loop when setting internal_quantity

There could be difference for Float field between the written value and the
read one. This could lead to an infinite loop of write calls, so we also test
that it is not already writing the same internal value.

issue3332
review1109002
(transplanted from 43b8d3d42033fb6fe5134cee3bc9facb0d351451)
This commit is contained in:
Cédric Krier committed 2013-10-03 21:18:46 +02:00
1 parent 05eb4fabd1
commit 5f9f8e080e
1 file changed
+2 -1
+2 -1
View File
@@ -534,7 +534,8 @@ class Move(Workflow, ModelSQL, ModelView):
for move in moves:
internal_quantity = cls._get_internal_quantity(move.quantity,
move.uom, move.product)
if internal_quantity != move.internal_quantity:
if (internal_quantity != move.internal_quantity
and internal_quantity != vals.get('internal_quantity')):
cls.write([move], {
'internal_quantity': internal_quantity,
})