[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) <rli@odoo.com>
This commit is contained in:
Josse Colpaert
2019-09-06 08:11:59 +00:00
parent b7c717d959
commit cc505b4b57
-1
View File
@@ -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'):