İçereği Atla
Menü
Bu soru işaretlendi

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Kas 22
4693
0
Ağu 21
3210
1
Ara 20
14042
3
Ağu 24
7030
1
Oca 24
1884