Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

record rules - labels / field names; from where to take it / where to look for?

By
TS
on 10/8/15, 5:42 AM 336 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

1

Axel Mendoza

--Axel Mendoza--
10203
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 10/8/15, 11:08 PM

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

TS
on 10/10/15, 6:48 AM

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.

Axel Mendoza
on 10/10/15, 11:34 AM

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

Axel Mendoza
on 10/10/15, 11:37 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 10/8/15, 5:42 AM
Seen: 336 times
Last updated: 10/8/15, 11:08 PM