[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:
qdp-odoo
2018-07-26 02:18:37 +02:00
parent c75f3a007c
commit d519082137
+5 -5
View File
@@ -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):