Odoo Help

3
3 Answers
4
Avatar

AJ Schrafel Paper Corp

--AJ Schrafel Paper Corp--
2140
| 5 5 8
Bronx, United States
--AJ Schrafel Paper Corp--

Exploring OpenERP for business

AJ Schrafel Paper Corp
9/26/13, 11:49 AM

Domains are tuples, the structure is (field, operator, value).

Field is the data in the database, Operator is the comparison, = equal, != not equal, > greater than, < less than, etc. Value is the data you want to compare with the field, it can be another database field, a constant or a calculated value.

Typically when you send a domain into a function it is sent as an array so it must be contained with in brackets [ ] whether you have 1 or more tuples.

The default operator between tuples in the array is & (AND), to modify that you can use | to indicate OR

So in your example the domain is ['|',('order_id.user_id','=',user.id),('order_id.user_id','=',False)]

translated in to human: orders with the same user id OR a blank user id will be part of the domain.

Without seeing the rest of the code a better answer cannot be given on what exactly the domain will be because user.id is not known from that code alone.

1
Avatar

Francesco OpenCode

--Francesco OpenCode--

3859
| 6 8 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
9/25/13, 11:52 AM

This is the system used to create the structure for the domain:

https://en.wikipedia.org/wiki/Polish_notation

Study it (search Polish notation on a search engine) to understand this structure.

2 Comments
Mohd Ahmad
9/25/13, 12:13 PM

Hi thanks for the answer. but my actual concern is the anatomy .I want to know the exact meaning of (order_id.user_id','=',user.id) , what is order_id , user_id, and user.id. are they referencing any table . if yes then how am i supposed to know which one .... basically i want to know decipher the notation from bottom up so that can use it as per my requirement.

Akhmad Mizkat
11/27/13, 10:50 PM

Hi Ahmad, if you want to know the meaning of order_id.user_id, here is my thought : in your entity that contain domain above, you have an attribute named order_id which typed as many2one with your another entity. So the "order_id.user_id" is refer to the user_id column in your another entity which referenced as many2one by the order_id attribute. As for the "user.id", I have no idea where is that come from, because your snippet code is too short. Hope this help.. :)

0
Mohammed Mansour
2/5/15, 9:26 AM

You will find the answer here by @Ray Carnes

Really it's very good answer

https://www.odoo.com/forum/help-1/question/domain-notation-using-multiple-and-nested-and-2170

and to read more about Openerp Polish notation open this link http://en.wikipedia.org/wiki/Polish_notation

Ask a Question
Writer
Keep Informed
0 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now