From e3f99885ca789b338a4cb9ab9a154db50dff500d Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 3 Jan 2017 17:29:20 +0100 Subject: [PATCH] [IMP] web, *: add new Domain and Field selection widgets * base_action_rule, gamification, mass_mailing 1) Create the independant DomainSelector widget - Allow to build a prefix char domain 2) Replace old FieldCharDomain with a new FieldDomain which uses the new DomainSelector widget 3) Create the independant ModelFieldSelector widget - Allow to build a valid field chain for a specific model (e.g 'partner_id.name' for a 'res.users') - Used by DomainSelector widget --- The DomainSelector widget uses a tree-like representation with user-friendly buttons (ALL/ANY/+/-/...). Any domain can be built, except those containing the "!" (not) operator or some operators like "like", "child_of" (@see DomainSelector). However, if the user enters these in the debug input, the widget can handle them. Note: these widgets had to do unusual stuff the widget API does not allow to handle efficiently right now but it will be adapted to the new widget/field API in a further update. Note2: the widgets also have possibility of other improvements like supporting m2o input instantiation in DomainLeaf, etc. --- This work is an adaptation of the original code made by @pga-odoo. --- .../views/base_action_rule_view.xml | 4 +- addons/gamification/data/goal_base.xml | 4 +- addons/gamification/views/challenge.xml | 2 +- .../mass_mailing/views/mass_mailing_views.xml | 6 +- addons/web/static/src/js/views/form_common.js | 49 +- .../web/static/src/js/views/form_widgets.js | 158 ++--- .../static/src/js/widgets/domain_selector.js | 559 ++++++++++++++++++ .../src/js/widgets/model_field_selector.js | 318 ++++++++++ .../web/static/src/less/domain_selector.less | 84 +++ .../static/src/less/model_field_selector.less | 97 +++ addons/web/static/src/xml/base.xml | 158 ++++- addons/web/views/webclient_templates.xml | 4 + 12 files changed, 1314 insertions(+), 129 deletions(-) create mode 100644 addons/web/static/src/js/widgets/domain_selector.js create mode 100644 addons/web/static/src/js/widgets/model_field_selector.js create mode 100644 addons/web/static/src/less/domain_selector.less create mode 100644 addons/web/static/src/less/model_field_selector.less diff --git a/addons/base_action_rule/views/base_action_rule_view.xml b/addons/base_action_rule/views/base_action_rule_view.xml index a061e5c8691..a03a23ef36c 100644 --- a/addons/base_action_rule/views/base_action_rule_view.xml +++ b/addons/base_action_rule/views/base_action_rule_view.xml @@ -28,7 +28,7 @@