Openerp domain rules

Source: Internet
Author: User
Tags in domain

The domain in OE is mostly used for Custom Search conditions.

A single condition in domain is a triple consisting of three elements. The first is a column of the object, that is, the field name; the second is the comparison operator ''= ,! =, & Gt;, >=, <, & lt; =, like, Ilike, in, not in, child_of, parent_left, parent_right ''; the third is the value used for comparison. Use "|" (OR), "&" (and), and "!" for multiple conditions. (No) logical operator link. Logical operators are prefixed before conditions. "|" And "&" must be linked to two conditions, "!" Returns the inverse of a condition. The default logical operator is "&".

For example:

['|', '|', ('Group _ id', 'in', [G. ID for G in user. groups_id]), ('user _ id', '=', user. ID), '&', ('user _ id', '=', false), ('group _ id', '=', false), '| ', '|', ('Company _ id', '=', false), ('Company _ id', 'Child _ of ', [user. company_id.id]), ('Company _ id. child_ids ', 'Child _ of', [user. company_id.id])]

This example indicates:

['| ',

'|', ('Group _ id', 'in', [G. ID for G in user. groups_id]), ('user _ id', '=', user. ID ),

'&', ('User _ id', '=', false), ('group _ id', '=', false ),

'| ',

'|', ('Company _ id', '=', false), ('Company _ id', 'Child _ of ', [user. company_id.id]),

('Company _ id. child_ids ', 'Child _ of', [user. company_id.id])]

Easy to read:

('Group _ id', 'in', [G. ID for G in user. groups_id]) or ('user _ id', '=', user. ID) or ('user _ id', '=', false) and ('group _ id', '=', false )) or ('Company _ id', '=', false) or ('Company _ id', 'Child _ of ', [user. company_id.id]) or ('Company _ id. child_ids ', 'Child _ of', [user. company_id.id])

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.