issue12547.diff [stock_lot] Check lot required only when changing move to done

#161970
This commit is contained in:
Raimon Esteve 2023-12-13 10:09:23 +01:00
parent ded59f1106
commit d57ce0078d
3 changed files with 30 additions and 3 deletions

25
issue12547.diff Normal file
View File

@ -0,0 +1,25 @@
diff --git a/tryton/modules/stock_lot/stock.py b/tryton/modules/stock_lot/stock.py
index 734018dbe8..1367b57e5f 100644
--- a/tryton/modules/stock_lot/stock.py
+++ b/tryton/modules/stock_lot/stock.py
@@ -420,8 +420,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)):
@@ -430,8 +429,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()

View File

@ -1,7 +1,7 @@
diff --git a/sao/src/model.js b/sao/src/model.js
diff --git a/tryton/sao/src/model.js b/tryton/sao/src/model.js
index 81e8639d9e..8b55441294 100644
--- a/sao/src/model.js
+++ b/sao/src/model.js
--- a/tryton/sao/src/model.js
+++ b/tryton/sao/src/model.js
@@ -2071,6 +2071,10 @@
rec_name = '';
}

2
series
View File

@ -135,3 +135,5 @@ issue12553.diff # [sao] Select first visible siblings when page is hidden
update_trees_chart_accounts.diff # [account_account] Update trees of chart of accounts with 2 passes
issue12799.diff # [sao] Convert negative id value as None when set by the client
issue12547.diff # [stock_lot] Check lot required only when changing move to done