Web Domain Field | The Odoo Community Organisation | OCA
Maybe your like
When you define a view you can specify on the relational fields a domain attribute. This attribute is evaluated as filter to apply when displaying existing records for selection.
<fieldname="product_id"domain="[('type','=','product')]"/>The value provided for the domain attribute must be a string representing a valid Odoo domain. This string is evaluated on the client side in a restricted context where we can reference as right operand the values of fields present into the form and a limited set of functions.
In this context it's hard to build complex domain and we are facing to some limitations as:
- The syntax to include in your domain a criteria involving values from a x2many field is complex.
- The right side of domain in case of x2many can involve huge amount of ids (performance problem).
- Domains computed by an onchange on an other field are not recomputed when you modify the form and don't modify the field triggering the onchange.
- It's not possible to extend an existing domain. You must completely redefine the domain in your specialized addon
- etc...
In order to mitigate these limitations this new addon allows you to use the value of a field as domain of an other field in the xml definition of your view.
<fieldname="product_id_domain"invisible="1"/><fieldname="product_id"domain="product_id_domain"/>The field used as domain must provide the domain as a JSON encoded string.
product_id_domain = fields.Char( compute="_compute_product_id_domain", readonly=True, store=False,)@api.multi@api.depends('name')def_compute_product_id_domain(self): for rec in self: rec.product_id_domain = json.dumps( [('type', '=', 'product'), ('name', 'like', rec.name)] )Usage
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.
Credits
Images
- Odoo Community Association: Icon.
Contributors
- Laurent Mignon <[email protected]>
- Denis Roussel <[email protected]>
Maintainer
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.
Tag » Add Domain Field Odoo
-
Odoo 14: How I Can Set Domain Filter On Many2one Type Field
-
Odoo 10 | How To Add Domain To Many2one Field Product_id In The ...
-
How To Add A Domain To A Many2one Field In Odoo?
-
Use A Domain Filter On Many2one Field | Odoo
-
How Do I Add A Domain To A Related Field? | Odoo
-
How To Add Domain In Website From Field? | Odoo
-
How To Add A Domain For A Field In Odoo15 | Odoo 15 Development ...
-
Domain In Odoo - Odoo Tricks And Tips
-
How To Add A Domain To A Many2one Field In Odoo? - Stack Overflow
-
Add A Domain For A Field In Odoo15 - Cybrosys Technologies
-
[13.0] Odoo Studio Domain Is Not Supported Errors #42609 - GitHub
-
Add Domain Filter On Many2many Field In Odoo
-
Search Code Snippets | Domain In Field Odoo
-
Working With Context And Domain In Odoo V9 - Surekha Technologies