issue11945.diff [stock] Ignore assign can ignore more than moves displayed on wizard

This commit is contained in:
Raimon Esteve 2023-02-14 12:58:04 +01:00
parent 77dbc03dbb
commit 4151bc0a59
2 changed files with 45 additions and 0 deletions

44
issue11945.diff Normal file
View File

@ -0,0 +1,44 @@
diff --git a/tryton/modules/stock/shipment.py b/tryton/modules/stock/shipment.py
index c84676d730..324e8999ac 100644
--- a/tryton/modules/stock/shipment.py
+++ b/tryton/modules/stock/shipment.py
@@ -62,16 +62,26 @@ class ShipmentAssignMixin(ShipmentMixin):
cls.assign(shipments)
@dualmethod
- def assign_ignore(cls, shipments):
+ def assign_ignore(cls, shipments, moves=None):
pool = Pool()
Move = pool.get('stock.move')
- Move.write([
- m for s in shipments for m in s.assign_moves
- if m.assignation_required
- and m.state in {'staging', 'draft'}], {
+ assign_moves = {
+ m for s in shipments for m in s.assign_moves
+ if m.assignation_required and m.state in {'staging', 'draft'}}
+ if moves is None:
+ moves = list(assign_moves)
+ else:
+ moves = [m for m in moves if m in assign_moves]
+ Move.write(moves, {
'quantity': 0,
})
- cls.assign(shipments)
+ to_assign = [
+ s for s in shipments
+ if all(
+ m.state not in {'staging', 'draft'}
+ for m in s.assign_moves if m.assignation_required)]
+ if to_assign:
+ cls.assign(to_assign)
@classmethod
def _get_assign_domain(cls):
@@ -2707,7 +2717,7 @@ class Assign(Wizard):
return 'end'
def transition_ignore(self):
- self.record.assign_ignore()
+ self.record.assign_ignore(self.partial.moves)
return 'end'

1
series
View File

@ -16,6 +16,7 @@ search_warehouse.diff # [stock] search function for warehouse
model.diff # [trytond] Allows dynamic fields in Model as required by the wizard in sale_pos_template_quantities
issue9802.diff # [stock] Improve performance when partially assigning moves
issue11945.diff # [stock] Ignore assign can ignore more than moves displayed on wizard
sao_colors.diff # [sao] Use the same colors as 5.4 version