diff --git a/addons/stock/models/product_strategy.py b/addons/stock/models/product_strategy.py
index 66817f0404e..70cd7ef466a 100644
--- a/addons/stock/models/product_strategy.py
+++ b/addons/stock/models/product_strategy.py
@@ -27,6 +27,10 @@ class StockPutawayRule(models.Model):
def _default_location_id(self):
if self.env.context.get('active_model') == 'stock.location':
return self.env.context.get('active_id')
+ if not self.env.user.has_group('stock.group_stock_multi_warehouses'):
+ wh = self.env['stock.warehouse'].search([('company_id', '=', self.env.company.id)], limit=1)
+ input_loc, _ = wh._get_input_output_locations(wh.reception_steps, wh.delivery_steps)
+ return input_loc
def _default_product_id(self):
if self.env.context.get('active_model') == 'product.template' and self.env.context.get('active_id'):
@@ -62,7 +66,7 @@ class StockPutawayRule(models.Model):
domain="[('child_ids', '!=', False), '|', ('company_id', '=', False), ('company_id', '=', company_id)]",
default=_default_location_id, required=True, ondelete='cascade', index=True)
location_out_id = fields.Many2one(
- 'stock.location', 'Store to', check_company=True,
+ 'stock.location', 'Store to sublocation', check_company=True,
domain="[('id', 'child_of', location_in_id), '|', ('company_id', '=', False), ('company_id', '=', company_id)]",
required=True, ondelete='cascade')
sequence = fields.Integer('Priority', help="Give to the more specialized category, a higher priority to have them in top of the list.")
@@ -75,14 +79,15 @@ class StockPutawayRule(models.Model):
@api.onchange('location_in_id')
def _onchange_location_in(self):
+ child_location_count = 0
if self.location_out_id:
child_location_count = self.env['stock.location'].search_count([
('id', '=', self.location_out_id.id),
('id', 'child_of', self.location_in_id.id),
('id', '!=', self.location_in_id.id),
])
- if not child_location_count:
- self.location_out_id = None
+ if not child_location_count or not self.location_out_id:
+ self.location_out_id = self.location_in_id
def write(self, vals):
if 'company_id' in vals:
diff --git a/addons/stock/views/product_strategy_views.xml b/addons/stock/views/product_strategy_views.xml
index 967739c950b..4cc85ae4492 100644
--- a/addons/stock/views/product_strategy_views.xml
+++ b/addons/stock/views/product_strategy_views.xml
@@ -22,14 +22,17 @@
force_save="1"/>
-
+
-
+
-
+ options="{'no_create': True}"
+ optional="show"/>
+
diff --git a/addons/stock/views/stock_location_views.xml b/addons/stock/views/stock_location_views.xml
index e343f40d875..be43fb3ce3a 100644
--- a/addons/stock/views/stock_location_views.xml
+++ b/addons/stock/views/stock_location_views.xml
@@ -111,6 +111,14 @@
+
+ Locations
+ ir.actions.act_window
+ stock.location
+ tree,form
+ [('storage_category_id', '=', active_id)]
+
+
Locations
stock.location
diff --git a/addons/stock/views/stock_storage_category_views.xml b/addons/stock/views/stock_storage_category_views.xml
index 897e5077a73..1ddb4c4c580 100644
--- a/addons/stock/views/stock_storage_category_views.xml
+++ b/addons/stock/views/stock_storage_category_views.xml
@@ -6,6 +6,9 @@