Sunday 20 September 2015

What is the difference between context and domain in odoo? | OpenERP

Context: is a dictionary which contains some information like: user language, company, timezone, etc by default. You can pass any kind of data/information in context as per your need either from xml or from py (mehtods) and then based on that extra information you can write your process code.
Domain: is a condition(s) which is used to filter your data or for searching. For more information about domain see this.

How to filter datas in OpenERP using domain list :
  1. Each tuple in the search domain needs to have 3 elements, in the form: ('field_name', 'operator', value), where:
  2. field_name must be a valid name of field of the object model, possibly following many-to-one relationships using dot-notation, e.g 'street' or 'partner_id.country' are valid values.
  3. operator must be a string with a valid comparison operator from this list: =, !=, >, >=, <, <=, like, ilike, in, not in, child_of, parent_left, parent_right The semantics of most of these operators are obvious. The child_of operator will look for records who are children or grand-children of a given record, according to the semantics of this model (i.e following the relationship field named by self._parent_name, by default parent_id.
  4. value must be a valid value to compare with the values of field_name, depending on its type.

No comments:

Post a Comment