Do not fail to duplicate lot with an empty lot list

This commit is contained in:
Cédric Krier
2025-07-15 17:44:06 +02:00
parent 9c1824a913
commit 9b6ea0ae6a
+6 -5
View File
@@ -607,11 +607,12 @@ class MoveAddLotsStart(ModelView):
methods=['on_change_with_quantity_remaining'])
def duplicate_lot(self):
lots = list(self.lots)
template, = self.lots
for i in range(self.duplicate_lot_number):
lot = copy(template)
lot._id = None
lots.append(lot)
if self.lots:
template, = self.lots
for i in range(self.duplicate_lot_number):
lot = copy(template)
lot._id = None
lots.append(lot)
self.lots = lots
self.quantity_remaining = self.on_change_with_quantity_remaining()