콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
4140 화면

Hello,


I am trying to set some record rules to limit visibility of records; general rule how to do it I  know, thing is that for some case I cen guess / find in internet how the rule should look like. Examples like:

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

are quite obvious in internet I've found also:

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

are also somehow clear. I've tried to find such names browsing using developer mode, and browsing what is available via 'debug window' - but even there I was not able to find labels / entries like:

[('department_id','=',user.context_department_id.id)]

where is 'user.context_departament.id'.. :/


Is there something like full list of such labels / fields? How can I  know which one I  could use? Also there are entries similar to below:

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

Where to find what '|' means? Also where to read what is role of all these chars like , ' | ?


regards

Tomasz

아바타
취소
베스트 답변

For know what it's available for domains operators, check this:

https://www.odoo.com/documentation/8.0/reference/orm.html#domains

For how to build a domain rule like using a function field to return a list of ids for using it in the domain, check this:

https://www.odoo.com/forum/hilfe-1/question/90009/#answer-90031

아바타
취소
작성자

Thanks Axel - it is helpful, however still have question - where should I look to find list of all these 'user.id', 'manager_id' and others? Also where to find relation between these? I guess there are some connection between these like in any relational database, but where to find these fields and relation between them explained? regards Tomasz

You define a domain for a model in Odoo. That model contains fields, you use that fields in your domain to apply criterions to the query generated by Odoo to search your model. for example, model1 have a field code you can use that field code to build a domain: [('code','=','15')]
You cannot use a field in the domain that do not belong to the model that will receive the domain search.

For domain rules you also have the current user object to be used in the right to compare with the model field on the left. You could use domain dot notation to walk through the model relation fields, normally many2one fields

관련 게시물 답글 화면 활동
2
1월 24
3350
0
1월 24
1597
0
12월 20
2152
1
9월 19
4958
0
6월 17
3201