Odoo Help


What is diff between domain, domain filter and attr ? [Closed]

on 6/14/13, 5:24 AM 3,172 views

The Question has been closed

Sudhir Arya (ERP Harbor Consulting Services)
on 06/14/2013 11:23:11

Can any one explain me the use of domain , domain filter and attrs in xml files ? Please also explain that which should be used in which scenario.


Francesco OpenCode

--Francesco OpenCode--

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

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

Francesco OpenCode
On 6/14/13, 5:42 AM

Domain = It's a filter you can apply on a relation field. For example, if you hae a relation to res.partner, with domain you can obtain only customer in the search.

Example: Search only customer in a many2one field with res.partner relaton

<field name="partner_id" string="Partner" domain="[('customer','=',True)]"/>

Filter Domain = It's a composite filter you can use in the search field. For example, when you searcha product in the warehouse section, you can search it by name or by code because the module use domain_filter to create a composite filter

Example: Search product for name or code in te some search field

<field name="name" string="Product" filter_domain="['|',('name','ilike',self),('default_code','ilike',self)]"/>

Attrs = They are a series of values use to indicates some parameters for the field in relation with other parameter. For example you can change the reaonly, invisible or required state of a field in relation to another field in thesome form.

Example: Field name readonly if state is not draft and required if amount is 0

<field name="name" attrs={'readonly':[('state', '!=', 'draft'), 'required':[('amount', '=', 0)]}/>

Explained very well :) Thank you Francesco :)

on 6/14/13, 8:32 AM

Nice help you...;)

Francesco OpenCode
on 6/14/13, 8:35 AM

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.


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)


Asked: 6/14/13, 5:24 AM
Seen: 3172 times
Last updated: 3/16/15, 8:10 AM