Skip to Content
Menu
This question has been flagged
1 Reply
2938 Views

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

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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

Related Posts Replies Views Activity
2
Jan 24
1177
0
Jan 24
469
0
Dec 20
1051
1
Sep 19
3659
0
Jun 17
2085