Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
7178 Lượt xem

Hi all,


I'm trying to filter views based on the allowed companies for a user in a multicompany setup.

  • The python class has a field 'building_owner_id', which is a M2O to res.company

  • I want that a user only sees the records where 'building_owner_id' is in her/his list of allowed companies (so the field 'company_ids' from res.user).

Any suggestions?



Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you Mohammed! The record rule works as expected.

Câu trả lời hay nhất

you can create a record rule for that class which compares the building_owner_id and current user's allowed companies.

use this domain for the record rule:

[('building_owner_id','in',[user.company_ids.ids])]


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 21
3158
5
thg 9 20
12817
1
thg 6 24
11986
1
thg 3 15
5290
2
thg 3 15
7496