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.

1

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

By
Dharmraj
on 6/14/13, 5:24 AM 2,428 views

The Question has been closed

by
Sudhir Arya (SA)
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.

3

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 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 :)

Dharmraj
on 6/14/13, 8:32 AM

Nice help you...;)

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

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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