Use the effective date of the stock move to generate sequence when creating lot

Closes #14899
(grafted from e5f7e95553a42dc02ac9ea57002523bc87471353)

--HG--
branch : 7.0
This commit is contained in:
Sergi Almacellas Abellana
2026-06-26 19:04:26 +02:00
parent acc0d47661
commit 6339f1a233
2 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -874,7 +874,9 @@ class Production_Lot(metaclass=PoolMeta):
for move in production.outputs:
if not move.lot and move.product.lot_is_required(
move.from_location, move.to_location):
move.add_lot()
date = move.effective_date or production.effective_date
with Transaction().set_context(date=date):
move.add_lot()
if move.lot:
lots.append(move.lot)
moves.append(move)
+4 -1
View File
@@ -441,8 +441,11 @@ class Move(metaclass=PoolMeta):
pass
def add_lot(self):
transaction = Transaction()
if not self.lot and self.product:
lot = self.product.create_lot()
date = transaction.context.get('date') or self.effective_date
with Transaction().set_context(date=date):
lot = self.product.create_lot()
if lot:
self.lot = lot