diff --git a/modules/stock/CHANGELOG b/modules/stock/CHANGELOG index 33c95ff580..524a057f20 100644 --- a/modules/stock/CHANGELOG +++ b/modules/stock/CHANGELOG @@ -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 diff --git a/modules/stock/shipment.py b/modules/stock/shipment.py index b166ce2ebd..ddc7eb0109 100644 --- a/modules/stock/shipment.py +++ b/modules/stock/shipment.py @@ -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] diff --git a/modules/stock/tests/scenario_stock_shipment_out_same_storage_output.rst b/modules/stock/tests/scenario_stock_shipment_out_same_storage_output.rst index e4e9956ee9..be64e9c07e 100644 --- a/modules/stock/tests/scenario_stock_shipment_out_same_storage_output.rst +++ b/modules/stock/tests/scenario_stock_shipment_out_same_storage_output.rst @@ -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')