Odoo Help

0

Where do I use () or [] for write domain expression?

By
Bonnet Denis
on 5/30/13, 7:20 AM 2,145 views

Sometimes I found ('','','') expression for domain or ['','',''].

I want to know : Where do I use () or [] for write domain expression?

1
Francesco OpenCode
On 5/30/13, 7:37 AM

The two datatype are equal in this case. If you create a filter you can use tuple or list. The standard is to set the filters as list of tuple. This is an example:

filter = [('name', 'ilike', 'OpenERP'), ('type', '=', 'erp')]

I can use list or tuple in .xml file AND in UI form ?

Bonnet Denis
on 5/30/13, 7:57 AM

You can use tuple and list in every point of the software. This type of data are part of python.

Francesco OpenCode
on 5/30/13, 8:08 AM

thanks for your answer

Bonnet Denis
on 5/30/13, 8:17 AM
1

Hello Denis,

Domain is a python code for optional restriction in the form of arguments for search.

Syntax:

domain =  [['field_name', 'operator', 'value'], ...]

For example,

domain = [('state','<>','draft'), ('country_id', '=', country_id)]

Thank you.

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

Question tools

0 follower(s)

Stats

Asked: 5/30/13, 7:20 AM
Seen: 2145 times
Last updated: 3/16/15, 8:10 AM