From cc505b4b578a07b3086eed39b313b7fc8794ba93 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 6 Sep 2019 08:11:48 +0000 Subject: [PATCH] [FIX] base: partner of company should be shared in multi-company We got an error before e.g. when we changed the address of a created company because the company created is not yet in the allowed_companies in the environment. Also, it does not make sense that the company of the partner of a company is that company. When you create a new partner, partners are shared by default between companies (company_id False). And in most multi-company situations, operations are made between them, so it makes extra sense to share their partners. So, we don't set the company of the partner of a company anymore. closes odoo/odoo#36510 Signed-off-by: Romain Libert (rli) --- odoo/addons/base/models/res_company.py | 1 - 1 file changed, 1 deletion(-) diff --git a/odoo/addons/base/models/res_company.py b/odoo/addons/base/models/res_company.py index 53126c0524d..84e4468850d 100644 --- a/odoo/addons/base/models/res_company.py +++ b/odoo/addons/base/models/res_company.py @@ -229,7 +229,6 @@ class Company(models.Model): company = super(Company, self).create(vals) # The write is made on the user to set it automatically in the multi company group. self.env.user.write({'company_ids': [(4, company.id)]}) - partner.sudo().write({'company_id': company.id}) # Make sure that the selected currency is enabled if vals.get('currency_id'):