2018-01-18 10:57:39 +01:00
|
|
|
-
|
|
|
|
!python {model: stock.warehouse, id: warehouse0}: |
|
|
|
|
warehouse = self.env['stock.warehouse'].browse(ref('warehouse0'))
|
|
|
|
branch_id = self.env['res.branch'].browse(ref('base_branch_company.data_branch_1'))
|
|
|
|
warehouse.write({'branch_id': branch_id.id})
|
|
|
|
|
2018-01-16 06:58:15 +01:00
|
|
|
-
|
|
|
|
!python {model: res.partner, id: base.main_partner}: |
|
|
|
|
main_warehouse = self.env['stock.warehouse'].browse(ref('warehouse0'))
|
|
|
|
self.write({'property_stock_customer':main_warehouse.lot_stock_id.id})
|
|
|
|
|
|
|
|
-
|
|
|
|
!python {model: ir.model.data, id: False}: |
|
|
|
|
main_warehouse = self.env['stock.warehouse'].browse(ref('warehouse0'))
|
|
|
|
|
|
|
|
#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([('module', '=', xml_record['module']), ('model', '=', xml_record['model']), ('name', '=', xml_record['name'])]).ids
|
|
|
|
if not xml_ids:
|
|
|
|
self.create(xml_record)
|
|
|
|
#avoid the xml id and the associated resource being dropped by the orm by manually making a hit on it
|
|
|
|
self._update_dummy(xml_record['model'], xml_record['module'], xml_record['name'])
|
|
|
|
|
|
|
|
-
|
|
|
|
!python {model: res.company, id: False}: |
|
|
|
|
#create the transit location for each company existing
|
|
|
|
companies = self.search([('internal_transit_location_id', '=', False)])
|
|
|
|
for company in companies:
|
|
|
|
company.create_transit_location()
|
2018-01-18 10:57:39 +01:00
|
|
|
-
|
|
|
|
!python {model: stock.location, id: False}: |
|
|
|
|
branch_id = self.env['res.branch'].browse(ref('base_branch_company.data_branch_1'))
|
|
|
|
self.browse([
|
|
|
|
ref('stock_location_stock'),
|
|
|
|
ref('stock_location_output'),
|
|
|
|
ref('stock_location_company'),
|
|
|
|
|
|
|
|
]).write({'branch_id': branch_id.id})
|
|
|
|
|
|
|
|
|
2018-01-16 06:58:15 +01:00
|
|
|
|