Contributors mailing list archives

Browse archives


Re: Lots of our modules do not handle multi-company correctly with Odoo >= 13

Acsone SA/NV, Denis Roussel
- 09/02/2022 14:23:26
Hi Alex.

Indeed as `self.env.user.company_id` is used to represent the default company of the user and not the current one.

I think effort can be split through PSC's and I'll be pleased to be part of that effort.

We can at least create an issue for that in every repo (I don't know if it has been done automatically or not...)

Le mer. 9 févr. 2022 à 13:47, Alexandre Fayolle <> a écrit :
Dear colleagues,

It seems we have a widely spread bug on our code base, related to Odoo 
 >= 13.0 and multi-company.

Starting on Odoo 13.0 the company switch widget in the UI no longer 
changes the user's company_id field. It changes the company via the 
force_company context key, and you get the value of the current company 
by checking ``, and not any longer through 

This is documented in

However, in many places in our code base, I see things such as 

This calls for a massive bug fix campaign (and probably for an official 
statement from the community to ask customers to upgrade their modules 
if they are in multi-company).

I am not sure what the best course of action is.

Things I think we should do:

* gather information about affected modules and versions (so that people 
can quickly check if their instances are affected by this)
* prepare fixes and get them applied
* publish the fix versions
* be super careful about this in the reviews of module migration pull 
requests (I admit I have been careless on this, and I really feel bad 
about it)

Feedback welcome,

Alexandre Fayolle
Senior Software Engineer
Tel : +33 4 58 48 20 30

Camptocamp France SAS
18 rue du Lac Saint André
73 370 Le Bourget-du-Lac

Post to: