Check lot required only when changing move to done

Closes #12547
This commit is contained in:
Cédric Krier
2023-12-12 16:03:33 +01:00
parent 92c9467b9c
commit ea2dbe21d5
+4 -4
View File
@@ -448,8 +448,7 @@ class Move(metaclass=PoolMeta):
def check_lot(self):
"Check if lot is required"
if (self.state == 'done'
and self.internal_quantity
if (self.internal_quantity
and not self.lot
and self.product.lot_is_required(
self.from_location, self.to_location)):
@@ -458,8 +457,9 @@ class Move(metaclass=PoolMeta):
product=self.product.rec_name))
@classmethod
def validate(cls, moves):
super(Move, cls).validate(moves)
@ModelView.button
def do(cls, moves):
super().do(moves)
for move in moves:
move.check_lot()