Add patch for issue9902.

This commit is contained in:
Albert Cervera i Areny 2020-11-06 17:51:59 +01:00
parent 91e1a8e791
commit 7a990ae2fa
2 changed files with 36 additions and 0 deletions

34
issue9802.diff Normal file
View File

@ -0,0 +1,34 @@
index 7995ab4..fae4268 100644
--- a/trytond/trytond/modules/stock/move.py
+++ b/trytond/trytond/modules/stock/move.py
@@ -841,6 +841,8 @@ class Move(Workflow, ModelSQL, ModelView):
child_locations = {}
to_write = []
to_assign = []
+ to_copy_moves = []
+ to_copy_values = []
success = True
for move in moves:
if move.state != 'draft':
@@ -900,14 +902,19 @@ class Move(Workflow, ModelSQL, ModelView):
to_assign.append(move)
first = False
else:
- with Transaction().set_context(_stock_move_split=True):
- to_assign.extend(cls.copy([move], default=values))
+ to_copy_moves.append(move)
+ to_copy_values.append(values)
qty_default_uom = Uom.compute_qty(move.uom, qty,
move.product.default_uom, round=False)
from_key = get_key(move, from_location)
pbl[from_key] = pbl.get(from_key, 0.0) - qty_default_uom
+ if to_copy_moves:
+ with Transaction().set_context(_stock_move_split=True):
+ copied = cls.copy(to_copy_moves)
+ for record, values in zip(copied, to_copy_values):
+ to_write.extend([[record], values])
if to_write:
cls.write(*to_write)
if to_assign:

2
series
View File

@ -55,3 +55,5 @@ account_payment_search_payment_amount.diff # [account_payment] Optimize searcher
purchase_line_rule.diff # [purchase] Add missing rule on purchase_line
issue9797.diff # [account_payment_sepa] Slowness processing sepa
issue9802.diff # [stock] Improve performance when partially assigning moves