From f6b10b766e75fe3efe9272d02ea03de007ae3a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 14 Sep 2015 10:17:04 +0200 Subject: [PATCH] Add picking location on warehouse issue4911 review24281002 --- CHANGELOG | 1 + doc/index.rst | 17 +++++++++-------- location.py | 11 +++++++++++ shipment.py | 3 ++- view/location_form.xml | 2 ++ 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2d6f6a34da..c1f6eb840e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add picking location on warehouse * Always compute expected quantity in inventory * Allow to change the destination of internal shipment's moves * Allow to modify internal shipment moves in waiting state diff --git a/doc/index.rst b/doc/index.rst index bc2fb0c4fa..dab424169e 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -19,12 +19,13 @@ virtually stored. There are six types of locations: * Warehouse - Warehouses are meta-locations which define input, storage and output - locations. These locations are all of type Storage. Input and Output - are locations where incoming an outgoing product are temporally - stored awaiting transportation. The storage location is often the - biggest location where products are stored for middle or long - periods of time. + Warehouses are meta-locations which define input, storage, picking and output + locations. These locations are all of type Storage. Input and Output are + locations where incoming an outgoing product are temporally stored awaiting + transportation. The storage location is often the biggest location where + products are stored for middle or long periods of time. The picking location + is optionally where the products are picked by the customer shipment + otherwise the storage location is used. * Customer @@ -154,8 +155,8 @@ out of which the product are going) and two list of moves: * Inventory moves - The moves between a storage location and the output location of the - warehouse + The moves between the picking or storage location and the output location of + the warehouse * Outgoing moves diff --git a/location.py b/location.py index 3244ee780c..3f849e4937 100644 --- a/location.py +++ b/location.py @@ -90,6 +90,17 @@ class Location(ModelSQL, ModelView): ('parent', 'child_of', [Eval('id')]), ('parent', '=', None)]], depends=['type', 'active', 'id']) + picking_location = fields.Many2One( + 'stock.location', 'Picking', states={ + 'invisible': Eval('type') != 'warehouse', + 'readonly': ~Eval('active'), + }, + domain=[ + ('type', '=', 'storage'), + ('parent', 'child_of', [Eval('storage_location', -1)]), + ], + depends=['type', 'active', 'storage_location'], + help='If empty the Storage is used') quantity = fields.Function(fields.Float('Quantity'), 'get_quantity') forecast_quantity = fields.Function(fields.Float('Forecast Quantity'), 'get_quantity') diff --git a/shipment.py b/shipment.py index 530e17b053..1d163b4388 100644 --- a/shipment.py +++ b/shipment.py @@ -1068,8 +1068,9 @@ class ShipmentOut(Workflow, ModelSQL, ModelView): 'Return inventory move for the outgoing move' pool = Pool() Move = pool.get('stock.move') + wrh = move.shipment.warehouse return Move( - from_location=move.shipment.warehouse.storage_location, + from_location=wrh.picking_location or wrh.storage_location, to_location=move.from_location, product=move.product, uom=move.uom, diff --git a/view/location_form.xml b/view/location_form.xml index 04b5dbf603..1e91c0eabc 100644 --- a/view/location_form.xml +++ b/view/location_form.xml @@ -24,4 +24,6 @@ this repository contains the full copyright notices and license terms. -->