[FIX] stock: fix module installation
In case there are multiple companies that need to call create_transit_location() at the installation of module, orm was crashing because expecting a singleton when doing self.partner_id or self.id
This commit is contained in:
@@ -28,11 +28,11 @@ class Company(models.Model):
|
||||
location.sudo().write({'company_id': company.id})
|
||||
company.write({'internal_transit_location_id': location.id})
|
||||
|
||||
warehouses = self.env['stock.warehouse'].search([('partner_id', '=', self.partner_id.id)])
|
||||
warehouses.mapped('partner_id').with_context(force_company=self.id).write({
|
||||
'property_stock_customer': location.id,
|
||||
'property_stock_supplier': location.id,
|
||||
})
|
||||
warehouses = self.env['stock.warehouse'].search([('partner_id', '=', company.partner_id.id)])
|
||||
warehouses.mapped('partner_id').with_context(force_company=company.id).write({
|
||||
'property_stock_customer': location.id,
|
||||
'property_stock_supplier': location.id,
|
||||
})
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
|
||||
Reference in New Issue
Block a user