[FIX] Split demo_pre.yml in stock_data.xml for ir_model_data

bzr revid: jke@openerp.com-20131028103906-izdlfpzknc3j73kp
This commit is contained in:
jke-openerp 2013-10-28 11:39:06 +01:00
parent 0cac453e16
commit 57e794c2a9
5 changed files with 27 additions and 25 deletions

View File

@ -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

View File

@ -788,7 +788,7 @@
<field name="date_finished" invisible="1"/>
</group>
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection" />
<field name="move_prod_id" groups="stock.group_locations"/>
</group>
</group>

View File

@ -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',

View File

@ -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'])

View File

@ -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)