How to write a record rule based on user's manager? (odoo11)
I want to write record rules for the module I wrote... But I'll illustrate the problem with the following example.
Suppose in the module Purchase Agreement that have a field : Responsible (relation: res.users)
I want to define record rule that every manager will only see requests from users who are their managers.
(This indicates the relation between employee and department and manager in the HR module.)
but field(responsible) in the "purchase agreement" form is related with the res.users object!
How do I get it from the user field to its manager?
One way is to add the department field in the form purchase agreement and add a domain that each user will only see the departments they are a member of.
( <field domain="[('member_ids.user_id','=',user_id)]" name="department_id"/>
so, after user select from wich department does it request: I get manager of this department with record rule.
now you can help me find the best way?
I'm looking for a way to write permissions and record rules to all modules in my bussiness.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
2
Trả lời
6708
Lượt xem
Hi Nasim,
Please try like this
domain="[('manager_id.user_id', '=', your_id)]"
Try this domain
['|',(user_id,'=',user.id),('manager_id.user_id','=',user.id)]
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 11 23
|
7467 | ||
|
1
thg 7 18
|
7066 | ||
|
0
thg 6 24
|
1337 | ||
|
4
thg 4 23
|
11162 | ||
|
0
thg 10 21
|
2521 |