diff --git a/web_domain_field/README.rst b/web_domain_field/README.rst index fd67312ed..24ea0c59d 100644 --- a/web_domain_field/README.rst +++ b/web_domain_field/README.rst @@ -14,20 +14,20 @@ Web Domain Field :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github - :target: https://github.com/OCA/web/tree/15.0/web_domain_field + :target: https://github.com/OCA/web/tree/16.0/web_domain_field :alt: OCA/web .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_domain_field + :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_domain_field :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/162/15.0 + :target: https://runbot.odoo-community.org/runbot/162/16.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| -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. +This technical addon allows developers to specify a field domain in a view +using the value of another field in that view, rather than as a static +XML attribute. **Table of contents** @@ -89,13 +89,30 @@ The field used as domain must provide the domain as a JSON encoded string. [('type', '=', 'product'), ('name', 'like', rec.name)] ) +.. note:: + You do not actually need this module to craft a dynamic domain. Odoo comes + with its own `py.js `_ + web library to parse expressions such as domains. `py.js` supports more + complex expressions than just static lists. + + Here is an example of a conditional domain based on the value of another + field: + + .. code-block:: python + + (order_id or partner_id) and [('id', 'in', allowed_picking_ids)] + or [('state', '=', 'done'), ('picking_type_id.code', '=', 'outgoing')] + + For OCA modules, this method is preferred over adding this module as an + additional dependency. + 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -127,6 +144,6 @@ 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. -This module is part of the `OCA/web `_ project on GitHub. +This module is part of the `OCA/web `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_domain_field/readme/DESCRIPTION.rst b/web_domain_field/readme/DESCRIPTION.rst index 5aa1b96f3..79fdef1f8 100644 --- a/web_domain_field/readme/DESCRIPTION.rst +++ b/web_domain_field/readme/DESCRIPTION.rst @@ -1,3 +1,3 @@ -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. +This technical addon allows developers to specify a field domain in a view +using the value of another field in that view, rather than as a static +XML attribute. diff --git a/web_domain_field/readme/USAGE.rst b/web_domain_field/readme/USAGE.rst index b9c04da19..e32b3b7db 100644 --- a/web_domain_field/readme/USAGE.rst +++ b/web_domain_field/readme/USAGE.rst @@ -49,3 +49,20 @@ The field used as domain must provide the domain as a JSON encoded string. rec.product_id_domain = json.dumps( [('type', '=', 'product'), ('name', 'like', rec.name)] ) + +.. note:: + You do not actually need this module to craft a dynamic domain. Odoo comes + with its own `py.js `_ + web library to parse expressions such as domains. `py.js` supports more + complex expressions than just static lists. + + Here is an example of a conditional domain based on the value of another + field: + + .. code-block:: python + + (order_id or partner_id) and [('id', 'in', allowed_picking_ids)] + or [('state', '=', 'done'), ('picking_type_id.code', '=', 'outgoing')] + + For OCA modules, this method is preferred over adding this module as an + additional dependency. diff --git a/web_domain_field/static/description/index.html b/web_domain_field/static/description/index.html index 616d351fa..dab5696af 100644 --- a/web_domain_field/static/description/index.html +++ b/web_domain_field/static/description/index.html @@ -3,7 +3,7 @@ - + Web Domain Field