diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 14ff501f69f..68d87736e9d 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -439,7 +439,7 @@ class mrp_production(osv.osv):
try:
location_model, location_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_stock')
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
- except (orm.except_orm, ValueError):
+ except (orm.except_orm, ValueError):
location_id = False
return location_id
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index 8e708638331..ae5387d7302 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -788,7 +788,7 @@
-
+
diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py
index 998810b42d6..fe9c0dc078c 100644
--- a/addons/stock/__openerp__.py
+++ b/addons/stock/__openerp__.py
@@ -69,7 +69,7 @@ Dashboard / Reports for Warehouse Management will include:
],
'data': [
'security/stock_security.xml',
- 'security/ir.model.access.csv',
+ 'security/ir.model.access.csv',
'stock_data.xml',
'stock_data.yml',
'wizard/stock_move_view.xml',
diff --git a/addons/stock/stock_data.yml b/addons/stock/stock_data.yml
index 19fd0ec2f8e..bdf862175bf 100644
--- a/addons/stock/stock_data.yml
+++ b/addons/stock/stock_data.yml
@@ -1,5 +1,27 @@
-
!python {model: res.partner}: |
main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context)
- self.write(cr, uid, ref('base.main_partner'), {'property_stock_customer':main_warehouse.lot_stock_id.id})
+ self.write(cr, uid, ref('base.main_partner'), {'property_stock_customer':main_warehouse.lot_stock_id.id})
+
+-
+ !python {model: ir.model.data}: |
+ main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context)
+
+ #create xml ids for demo data that are widely used in tests or in other codes, for more convenience
+ xml_references = [
+ {'name': 'stock_location_stock', 'module': 'stock', 'model': 'stock.location', 'res_id': main_warehouse.lot_stock_id.id},
+ {'name': 'stock_location_company', 'module': 'stock', 'model': 'stock.location', 'res_id': main_warehouse.wh_input_stock_loc_id.id},
+ {'name':'stock_location_output','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_output_stock_loc_id.id},
+ {'name':'location_pack_zone','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_pack_stock_loc_id.id},
+ {'name':'picking_type_internal','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.int_type_id.id},
+ {'name':'picking_type_in','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.in_type_id.id},
+ {'name':'picking_type_out','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.out_type_id.id},
+ ]
+ for xml_record in xml_references:
+ xml_ids = self.search(cr, uid, [('module', '=', xml_record['module']), ('model', '=', xml_record['model']), ('name', '=', xml_record['name'])], context=context)
+ if not xml_ids:
+ self.create(cr, uid, xml_record, context=context)
+ #avoid the xml id and the associated resource being dropped by the orm by manually making a hit on it
+ self._update_dummy(cr, uid, xml_record['model'], xml_record['module'], xml_record['name'])
+
diff --git a/addons/stock/stock_demo_pre.yml b/addons/stock/stock_demo_pre.yml
index aa3270010c1..c752ebc28da 100644
--- a/addons/stock/stock_demo_pre.yml
+++ b/addons/stock/stock_demo_pre.yml
@@ -11,24 +11,4 @@
-
!python {model: ir.model.data}: |
main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context)
- main_stock = main_warehouse.lot_stock_id.id
- self.pool.get('stock.location').write(cr, uid, [ref('stock_location_14'), ref('stock_location_components')], {'location_id':main_stock}, context=context)
-
- #create xml ids for demo data that are widely used in tests, for more convenience
- xml_references = [
- {'name': 'stock_location_stock', 'module': 'stock', 'model': 'stock.location', 'res_id': main_warehouse.lot_stock_id.id},
- {'name': 'stock_location_company', 'module': 'stock', 'model': 'stock.location', 'res_id': main_warehouse.wh_input_stock_loc_id.id},
- {'name':'stock_location_output','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_output_stock_loc_id.id},
- {'name':'location_pack_zone','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_pack_stock_loc_id.id},
- {'name':'picking_type_internal','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.int_type_id.id},
- {'name':'picking_type_in','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.in_type_id.id},
- {'name':'picking_type_out','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.out_type_id.id},
- ]
- for xml_record in xml_references:
- xml_ids = self.search(cr, uid, [('module', '=', xml_record['module']), ('model', '=', xml_record['model']), ('name', '=', xml_record['name'])], context=context)
- if not xml_ids:
- self.create(cr, uid, xml_record, context=context)
- #avoid the xml id and the associated resource being dropped by the orm by manually making a hit on it
- self._update_dummy(cr, uid, xml_record['model'], xml_record['module'], xml_record['name'])
-
-
+ self.pool.get('stock.location').write(cr, uid, [ref('stock_location_14'), ref('stock_location_components')], {'location_id':main_warehouse.lot_stock_id.id}, context=context)