Manage assignation for customer shipment with same picking and output location

Closes #12815
This commit is contained in:
Cédric Krier committed 2023-12-21 15:01:14 +01:00
1 parent c6f095c760
commit 4a0a6faea6
3 files changed
+40 -8

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Manage assignation for customer shipment with same picking and output location
* Add pblc argument to assign_try
Version 7.0.0 - 2023-10-30
+8 -8
View File
@@ -1267,7 +1267,7 @@ class ShipmentOut(
('waiting', 'assigned'),
('waiting', 'picked'),
('assigned', 'picked'),
('waiting', 'packed'),
('assigned', 'packed'),
('picked', 'packed'),
('packed', 'done'),
('packed', 'waiting'),
@@ -1324,7 +1324,7 @@ class ShipmentOut(
'pack': {
'invisible': If(
Eval('warehouse_storage') == Eval('warehouse_output'),
Eval('state') != 'waiting',
Eval('state') != 'assigned',
Eval('state') != 'picked'),
'depends': [
'state', 'warehouse_storage', 'warehouse_output'],
@@ -1333,9 +1333,7 @@ class ShipmentOut(
'invisible': Eval('state') != 'packed',
},
'assign_wizard': {
'invisible': ((Eval('state') != 'waiting')
| (Eval('warehouse_storage')
== Eval('warehouse_output'))),
'invisible': Eval('state') != 'waiting',
},
'assign_try': {},
'assign_force': {},
@@ -1775,7 +1773,10 @@ class ShipmentOut(
@property
def assign_moves(self):
return self.inventory_moves
if self.warehouse_storage != self.warehouse_output:
return self.inventory_moves
else:
return self.outgoing_moves
@dualmethod
@ModelView.button
@@ -1783,8 +1784,7 @@ class ShipmentOut(
Move = Pool().get('stock.move')
shipments = [
s for s in shipments
if s.state == 'waiting'
and s.warehouse_storage != s.warehouse_output]
if s.state == 'waiting']
to_assign = [
m for s in shipments for m in s.assign_moves
if m.assignation_required]
@@ -14,6 +14,8 @@ Activate modules::
>>> config = activate_modules('stock')
>>> Move = Model.get('stock.move')
Create company::
>>> _ = create_company()
@@ -80,6 +82,35 @@ Set the shipment state to waiting::
>>> len(shipment_out.inventory_moves)
0
Try to assign::
>>> shipment_out.click('assign_try')
>>> shipment_out.state
'waiting'
>>> move, = shipment_out.outgoing_moves
>>> move.state
'draft'
Fill storage location::
>>> move = Move()
>>> move.from_location = warehouse_loc.lost_found_location
>>> move.to_location = storage_loc
>>> move.product = product
>>> move.quantity = 1
>>> move.click('do')
>>> move.state
'done'
Try to assign again::
>>> shipment_out.click('assign_try')
>>> shipment_out.state
'assigned'
>>> move, = shipment_out.outgoing_moves
>>> move.state
'assigned'
Pack the shipment::
>>> shipment_out.click('pack')