issue7697.diff # [stock] Do not compute internal quantity for stock move created without product nor unit

#162753
This commit is contained in:
Raimon Esteve 2023-11-15 07:26:58 +01:00
parent 14a3d8cbef
commit 83b0e9696b
2 changed files with 19 additions and 0 deletions

17
issue7697.diff Normal file
View File

@ -0,0 +1,17 @@
diff --git a/tryton/modules/stock/move.py b/tryton/modules/stock/move.py
index 7cf384510d..807f1c3313 100644
--- a/tryton/modules/stock/move.py
+++ b/tryton/modules/stock/move.py
@@ -801,8 +801,10 @@ class Move(Workflow, ModelSQL, ModelView):
# Use ordered dict to optimize cache alignment
products, uoms = OrderedDict(), OrderedDict()
for vals in vlist:
- products[vals['product']] = None
- uoms[vals['uom']] = None
+ if vals.get('product') is not None:
+ products[vals['product']] = None
+ if vals.get('uom') is not None:
+ uoms[vals['uom']] = None
id2product = {p.id: p for p in Product.browse(products.keys())}
id2uom = {u.id: u for u in Uom.browse(uoms.keys())}
for vals in vlist:

2
series
View File

@ -57,3 +57,5 @@ issue7672.diff # [stock] Always fill product and template of cost price revision
issue12678.diff # [account_statement] Not delete statement lines when statament is not draft state
account_statement_second_currency.diff # [account_statement] Support second currency on statement line
issue7697.diff # [stock] Do not compute internal quantity for stock move created without product nor unit