[FIX] stock: proper api.multi

Mixup with f7dcabf (saas-11.1) and a496ca9 (11.0) that was not properly ported
Avoid undefined variable if self is empoty (e.g. when reinstall stock)
This commit is contained in:
Martin Trigaux
2018-07-25 15:57:54 +02:00
parent 3c521f6d05
commit 5c44f205a2
+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', '=', location.partner_id.id)])
warehouses.mapped('partner_id').with_context(force_company=location.id).write({
'property_stock_customer': location.id,
'property_stock_supplier': location.id,
})
@api.model
def create(self, vals):