From 7531cd57f4367c30232becabd76ab02abdf69fe6 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Thu, 30 Sep 2021 11:20:39 +0200 Subject: [PATCH] [12.0][IMP] web_widget_one2many_product_picker, add all_domain option --- web_widget_one2many_product_picker/readme/CONFIGURE.rst | 1 + web_widget_one2many_product_picker/readme/CONTRIBUTORS.rst | 2 ++ .../static/src/js/widgets/field_one2many_product_picker.js | 7 ++++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web_widget_one2many_product_picker/readme/CONFIGURE.rst b/web_widget_one2many_product_picker/readme/CONFIGURE.rst index 0794fea11..52fac396d 100644 --- a/web_widget_one2many_product_picker/readme/CONFIGURE.rst +++ b/web_widget_one2many_product_picker/readme/CONFIGURE.rst @@ -39,6 +39,7 @@ Widget options: * show_discount > Enable/Disable display discount (False by default) * show_subtotal > Enable/Disable show subtotal (True by default) * auto_save > Enable/Disable auto save (False by default) +* all_domain > The domain used in 'All' section ([] by default) If using auto save feature, you should keep in mind that the "Save" and "Discard" buttons will lose part of its functionality as the document will be saved every time you diff --git a/web_widget_one2many_product_picker/readme/CONTRIBUTORS.rst b/web_widget_one2many_product_picker/readme/CONTRIBUTORS.rst index 150026f71..35d1357ea 100644 --- a/web_widget_one2many_product_picker/readme/CONTRIBUTORS.rst +++ b/web_widget_one2many_product_picker/readme/CONTRIBUTORS.rst @@ -3,3 +3,5 @@ * Alexandre D. Díaz * Pedro M. Baeza * David Vidal + +* Giovanni Serra diff --git a/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js b/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js index 08e6a576d..223b83029 100644 --- a/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js +++ b/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js @@ -85,9 +85,9 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun // Uses to work with searchs, so we can mix properties with the user values. this._searchContext = { - domain: this.mode === "readonly" ? this._getLinesDomain() : false, + domain: this.mode === "readonly" ? this._getLinesDomain() : this._activeSearchGroup.domain, text: false, - order: false, + order: this.mode === "readonly" ? false : this._activeSearchGroup.order, activeTest: true, }; if (this.mode === "readonly") { @@ -206,7 +206,7 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun this.searchGroups.splice(0, 0, { name: 'all', string: _t("All"), - domain: [], + domain: this.options.all_domain, order: false, active: !hasUserActive, }); @@ -456,6 +456,7 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun trigger_refresh_fields: ["partner_id", "currency_id"], auto_save: false, ignore_warning: false, + all_domain: [], }; },