[FIX] stock: xml_ids references due to the merge of stock and stock_location

bzr revid: qdp-launchpad@openerp.com-20131016093446-a1kd2pqsw224mii6
This commit is contained in:
Quentin (OpenERP) 2013-10-16 11:34:46 +02:00
parent 8e844ba109
commit 12338e7aa5
3 changed files with 34 additions and 19 deletions

View File

@ -2,15 +2,4 @@
!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})
-
!python {model: ir.model.data, noupdate: True}: |
main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context)
self.create(cr,uid,{'name':'stock_location_stock','module':'stock', 'model':'stock.location','res_id':main_warehouse.lot_stock_id.id}, context=context)
self.create(cr,uid,{'name':'stock_location_company','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_input_stock_loc_id.id}, context=context)
self.create(cr,uid,{'name':'stock_location_output','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_output_stock_loc_id.id}, context=context)
self.create(cr,uid,{'name':'location_pack_zone','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_pack_stock_loc_id.id}, context=context)
self.create(cr,uid,{'name':'picking_type_internal','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.int_type_id.id}, context=context)
self.create(cr,uid,{'name':'picking_type_in','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.in_type_id.id}, context=context)
self.create(cr,uid,{'name':'picking_type_out','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.out_type_id.id}, context=context)

View File

@ -71,8 +71,13 @@
!python {model: stock.picking}: |
main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context)
my_picking_type_out = main_warehouse.out_type_id.id
create_id = self.create(cr,uid,{'location_dest_id':ref('location_delivery_counter'),'picking_type_id':my_picking_type_out});
self.pool.get('ir.model.data').create(cr,uid,{'name':'outgoing_shipment','module':'stock', 'model':'stock.picking','res_id':create_id}, context=context)
create_id = self.create(cr,uid,{'location_dest_id':ref('location_delivery_counter'),'picking_type_id':my_picking_type_out})
for xml_record in [{'name':'outgoing_shipment','module':'stock', 'model':'stock.picking','res_id':create_id}]:
xml_ids = self.pool.get('ir.model.data').search(cr, uid, [('module', '=', xml_record['module']), ('model', '=', xml_record['model']), ('name', '=', xml_record['name'])], context=context)
if not xml_ids:
self.pool.get('ir.model.data').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.pool.get('ir.model.data')._update_dummy(cr, uid, xml_record['model'], xml_record['module'], xml_record['name'])
-
!record {model: stock.move, id: outgoing_shipment_icecream}:
picking_id: outgoing_shipment
@ -88,7 +93,12 @@
main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context)
my_picking_type = main_warehouse.in_type_id.id
create_id = self.create(cr,uid,{'location_dest_id':ref('location_refrigerator'),'picking_type_id':my_picking_type,'partner_id':ref('base.res_partner_address_9')});
self.pool.get('ir.model.data').create(cr,uid,{'name':'incomming_shipment','module':'stock', 'model':'stock.picking','res_id':create_id}, context=context)
for xml_record in [{'name':'incomming_shipment','module':'stock', 'model':'stock.picking','res_id':create_id}]:
xml_ids = self.pool.get('ir.model.data').search(cr, uid, [('module', '=', xml_record['module']), ('model', '=', xml_record['model']), ('name', '=', xml_record['name'])], context=context)
if not xml_ids:
self.pool.get('ir.model.data').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.pool.get('ir.model.data')._update_dummy(cr, uid, xml_record['model'], xml_record['module'], xml_record['name'])
-
!record {model: stock.move, id: incomming_shipment_icecream}:
picking_id: incomming_shipment

View File

@ -1,18 +1,34 @@
-
!record {model: stock.location, id: stock_location_14}:
name: Shelf 2
posx: 6512
posx: 0
-
!record {model: stock.location, id: stock_location_components}:
name: Shelf 1
posx: 6512
posx: 0
-
!python {model: stock.location}: |
!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
stock_loc_to_update = self.search(cr, uid, [('posx','=','6512')], context=context)
self.write(cr,uid,stock_loc_to_update,{'location_id':main_stock,'posx':'0'}, context=context)
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'])