I viewing the code of stock module in odoo. i know that record(product, customers) can be created using data file while installing module. i view the data file of stock module but there is no any records from where WH/Stock created.
like here partner location created using this. so from where WH/Stock Location created and how?
<record id="stock_location_locations_partner" model="stock.location">
<field name="name">Partner Locations</field>
<field name="usage">view</field>
<field name="posz">1</field>
<field name="company_id"></field>
</record>
When installing stock module first time the WH/Stock location created see below code of stock_warehouse.py file's create method in stock module. see the sub_locations dictionary in below code. only reference xml id assigned using yml file.
@api.model
def create(self, vals):
# create view location for warehouse then create all locations
loc_vals = {'name': _(vals.get('code')), 'usage': 'view',
'location_id': self.env.ref('stock.stock_location_locations').id}
if vals.get('company_id'):
loc_vals['company_id'] = vals.get('company_id')
vals['view_location_id'] = self.env['stock.location'].create(loc_vals).id
def_values = self.default_get(['reception_steps', 'delivery_steps'])
reception_steps = vals.get('reception_steps', def_values['reception_steps'])
delivery_steps = vals.get('delivery_steps', def_values['delivery_steps'])
sub_locations = {
'lot_stock_id': {'name': _('Stock'), 'active': True, 'usage': 'internal'},
'wh_input_stock_loc_id': {'name': _('Input'), 'active': reception_steps != 'one_step', 'usage': 'internal'},
'wh_qc_stock_loc_id': {'name': _('Quality Control'), 'active': reception_steps == 'three_steps', 'usage': 'internal'},
'wh_output_stock_loc_id': {'name': _('Output'), 'active': delivery_steps != 'ship_only', 'usage': 'internal'},
'wh_pack_stock_loc_id': {'name': _('Packing Zone'), 'active': delivery_steps == 'pick_pack_ship', 'usage': 'internal'},
}
for field_name, values in sub_locations.iteritems():
values['location_id'] = vals['view_location_id']
if vals.get('company_id'):
values['company_id'] = vals.get('company_id')
vals[field_name] = self.env['stock.location'].with_context(active_test=False).create(values).id
# actually create WH
warehouse = super(Warehouse, self).create(vals)
# create sequences and picking types
new_vals = warehouse.create_sequences_and_picking_types()
warehouse.write(new_vals) # TDE FIXME: use super ?
# create routes and push/procurement rules
route_vals = warehouse.create_routes()
warehouse.write(route_vals)
# update partner data if partner assigned
if vals.get('partner_id'):
self._update_partner_data(vals['partner_id'], vals.get('company_id'))
return warehouse