Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

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

by
Camptocamp France SAS, Alexandre Fayolle
- 09/02/2022 14:47:06
On 09/02/2022 14:37, Holger Brunn wrote:

> Thank you for raising this.

> 

>> * gather information about affected modules and versions (so that people

>> can quickly check if their instances are affected by this)

> 

> could we write the AST version of

> grep -RE 'user(_id|).company_id[^s]' --include=*.py

> ?

> (which already finds a lot of problematic cases, but also a lot of false

> positives we could exclude when knowing the code, like in default lambdas)

> 

> When we have that we could even flag such lines in PRs to have reviewers/

> contributors pay extra attention.

> 


I don't think we want to exclude default lambdas. In my opinion we want 
env.company_id in these (and this is what Odoo is using).

Tests are a bit more of an issue.

We should have a pylint check for this, I think, which would require an 
explicit deactivation to be able to use user.company_id anywhere.



-- 
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
France

http://www.camptocamp.com

Reference