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.

3

Understand Open Erp Domain Filter ?

By
Mohd Ahmad
on 9/25/13, 11:46 AM 9,514 views

HI I would like to ask you if you could please explain the anatomy of the Openerp domain filters. I have to use it my project. Please explain the anatomy and description of the following domain filter .

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

If you are having any resource concerning the same then please share it .

Thanks in advance ..

4

AJ Schrafel Paper Corp

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

Exploring OpenERP for business

AJ Schrafel Paper Corp
On 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

Francesco OpenCode

--Francesco OpenCode--
3608
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

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

Francesco OpenCode
On 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.

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.

Mohd Ahmad
on 9/25/13, 12:13 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.. :)

Akhmad Mizkat
on 11/27/13, 10:50 PM
0
Mohammed Mansour
On 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

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

0 follower(s)

Stats

Asked: 9/25/13, 11:46 AM
Seen: 9514 times
Last updated: 3/16/15, 8:10 AM