Skip to Content
Menu
This question has been flagged

Hi, I have a proyect who is multi company, and each company is base in a different country.

In my view, I want to hide information in the same model if the user is another company with a different country, for example in contracts, different countries have different required  fields or settings, so in this case I want to only show the pages to corresponding companies:

attrs="{'invisible': [('company.country_id.code', '!=', 'PE')]}">

attrs="{'invisible': [('company.country_id.code', '!=', 'CO')]}">

I know that creating a field related to company_id.country_id.code I could achieve this, but I am looking for a better way to do this insted of creating this field in every model. Maybe a group could also be applied, but if the same user has access to those multi-companies, then he would see all fields and not only those  corresponding to current country.

Another thing to take in consideration would be that the record could be company free, meaning that the company field is empty, because the record is shared for all companies, so I'm looking for a way to use self.env.company in a view, and since v13, an user can also select more than one company at the same time, the method to achieve this could also require a special method.

Avatar
Discard
Related Posts Replies Views Activity
2
Nov 22
3301
0
Aug 21
2073
1
Dec 20
12282
3
Aug 24
4705
1
Jan 24
599