diff --git a/addons/stock/data/stock_data.xml b/addons/stock/data/stock_data.xml
index fecb80d8145..d522f76d9c6 100644
--- a/addons/stock/data/stock_data.xml
+++ b/addons/stock/data/stock_data.xml
@@ -32,12 +32,6 @@
-
- Procurements
-
- procurement
-
-
Vendors
diff --git a/addons/stock/data/stock_demo.xml b/addons/stock/data/stock_demo.xml
index 5ba6b1a3dd6..f274a335fa7 100644
--- a/addons/stock/data/stock_demo.xml
+++ b/addons/stock/data/stock_demo.xml
@@ -7,41 +7,6 @@
-
-
-
- IT Vendors
-
- supplier
- 2601985
-
-
-
- Big Vendors
-
- supplier
-
-
-
- Generic IT Vendors
-
- supplier
-
-
-
- European Customers
-
- customer
-
-
-
- Non European Customers
-
- customer
-
-
-
-
diff --git a/addons/stock/data/stock_demo_pre.xml b/addons/stock/data/stock_demo_pre.xml
index f72e84cdfc2..57fac7bc229 100644
--- a/addons/stock/data/stock_demo_pre.xml
+++ b/addons/stock/data/stock_demo_pre.xml
@@ -4,12 +4,14 @@
Shelf 2
0
+ 2601985
Shelf 1
0
+ 2601892
diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py
index 2f16867a42c..ed3f845883b 100644
--- a/addons/stock/models/product.py
+++ b/addons/stock/models/product.py
@@ -338,11 +338,6 @@ class Product(models.Model):
res['fields']['virtual_available']['string'] = _('Future P&L')
if fields.get('qty_available'):
res['fields']['qty_available']['string'] = _('P&L Qty')
- elif location.usage == 'procurement':
- if fields.get('virtual_available'):
- res['fields']['virtual_available']['string'] = _('Future Qty')
- if fields.get('qty_available'):
- res['fields']['qty_available']['string'] = _('Unplanned Qty')
elif location.usage == 'production':
if fields.get('virtual_available'):
res['fields']['virtual_available']['string'] = _('Future Productions')
diff --git a/addons/stock/models/stock_location.py b/addons/stock/models/stock_location.py
index 6accdc3b01e..118a253398a 100644
--- a/addons/stock/models/stock_location.py
+++ b/addons/stock/models/stock_location.py
@@ -33,7 +33,6 @@ class Location(models.Model):
('internal', 'Internal Location'),
('customer', 'Customer Location'),
('inventory', 'Inventory Loss'),
- ('procurement', 'Procurement'),
('production', 'Production'),
('transit', 'Transit Location')], string='Location Type',
default='internal', index=True, required=True,
@@ -42,14 +41,12 @@ class Location(models.Model):
"\n* Internal Location: Physical locations inside your own warehouses,"
"\n* Customer Location: Virtual location representing the destination location for products sent to your customers"
"\n* Inventory Loss: Virtual location serving as counterpart for inventory operations used to correct stock levels (Physical inventories)"
- "\n* Procurement: Virtual location serving as temporary counterpart for procurement operations when the source (vendor or production) is not known yet. This location should be empty when the procurement scheduler has finished running."
"\n* Production: Virtual counterpart location for production operations: this location consumes the raw material and produces finished products"
"\n* Transit Location: Counterpart location that should be used in inter-company or inter-warehouses operations")
location_id = fields.Many2one(
'stock.location', 'Parent Location', index=True, ondelete='cascade',
help="The parent location that includes this location. Example : The 'Dispatch Zone' is the 'Gate 1' parent location.")
child_ids = fields.One2many('stock.location', 'location_id', 'Contains')
- partner_id = fields.Many2one('res.partner', 'Owner', help="Owner of the location if not internal")
comment = fields.Text('Additional Information')
posx = fields.Integer('Corridor (X)', default=0, help="Optional localization details, for information purpose only")
posy = fields.Integer('Shelves (Y)', default=0, help="Optional localization details, for information purpose only")
@@ -77,6 +74,11 @@ class Location(models.Model):
else:
self.complete_name = self.name
+ @api.onchange('usage')
+ def _onchange_usage(self):
+ if self.usage not in ('internal', 'inventory'):
+ self.scrap_location = False
+
def write(self, values):
if 'usage' in values and values['usage'] == 'view':
if self.mapped('quant_ids'):
@@ -97,6 +99,13 @@ class Location(models.Model):
" Please unreserve the products first."
))
if 'active' in values:
+ if values['active'] == False:
+ for location in self:
+ warehouses = self.env['stock.warehouse'].search([('active', '=', True), '|', ('lot_stock_id', '=', location.id), ('view_location_id', '=', location.id)])
+ if warehouses:
+ raise UserError(_("You cannot archive the location %s as it is"
+ " used by your warehouse %s") % (location.display_name, warehouses[0].display_name))
+
if not self.env.context.get('do_not_check_quant'):
children_location = self.env['stock.location'].with_context(active_test=False).search([('id', 'child_of', self.ids)])
internal_children_locations = children_location.filtered(lambda l: l.usage == 'internal')
diff --git a/addons/stock/tests/test_stock_location_search.py b/addons/stock/tests/test_stock_location_search.py
index 014759c7899..d19cfa8d775 100644
--- a/addons/stock/tests/test_stock_location_search.py
+++ b/addons/stock/tests/test_stock_location_search.py
@@ -7,7 +7,7 @@ class TestStockLocationSearch(common.TransactionCase):
def setUp(self):
super(TestStockLocationSearch, self).setUp()
self.location = self.env['stock.location']
- self.location_barcode = self.env.ref('stock.stock_location_3')
+ self.location_barcode = self.env.ref('stock.stock_location_14')
self.location_barcode_id = self.location_barcode.id
self.barcode = self.location_barcode.barcode
self.name = self.location_barcode.name
diff --git a/addons/stock/views/stock_location_views.xml b/addons/stock/views/stock_location_views.xml
index e7713c97fdf..b726d374970 100644
--- a/addons/stock/views/stock_location_views.xml
+++ b/addons/stock/views/stock_location_views.xml
@@ -34,9 +34,8 @@
-
-
+
diff --git a/addons/stock/views/stock_warehouse_views.xml b/addons/stock/views/stock_warehouse_views.xml
index 388411e285b..aab08987ed4 100644
--- a/addons/stock/views/stock_warehouse_views.xml
+++ b/addons/stock/views/stock_warehouse_views.xml
@@ -45,6 +45,8 @@
+
+
@@ -217,7 +219,7 @@
-
+