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

I want to prevent Project Managers editing the Project Settings of Projects that they are not the managers of.

For example, employee A and employee B both belong to the Project Manager group.  Employee A is the Project Manager of Project A.  Employee B is only a project team member of Project A and should not be able to edit its project settings.

I have the following rule:

['|',('project_id.user_id','=',user.id),('user_id','=',user.id)]

applied to the Task object and that successfully prevents employee B from editing tasks that are not assigned to him, but if I duplicate the rule and apply it to the Project object I get the following error:

ValueError: Invalid field 'project_id.user_id' in leaf "<osv.ExtendedLeaf: ('project_id.user_id', '=', 18) on project_project (ctx: )>"

Can anyone help?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

If you are using the record rule in project.project, you wouldn't use project_id right?

It would be only:

[('user_id','=',user.id)]

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

Ah, yes, that works. Thanks. What object is 'project_id.user_id' relevant to?

The left hand side of record rules are based on fields in that model. So the Task object has project_id variable, so you could 'project_id.user_id'. Any other model with a project_id field could also use a record rule similar to it

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 16
3626
1
thg 10 23
1347
0
thg 6 21
1510
0
thg 1 17
2818
1
thg 3 16
3554