3
0
Fork 0

[IMP] web_widget_one2many_product_picker: Add option 'all_domain' and auto-select search input content

13.0
Alexandre D. Díaz 2021-04-22 15:06:15 +02:00
parent 098df6a08f
commit 107d3a5114
4 changed files with 17 additions and 1 deletions

View File

@ -84,6 +84,7 @@ Widget options:
* show_discount > Enable/Disable display discount (False by default) * show_discount > Enable/Disable display discount (False by default)
* show_subtotal > Enable/Disable show subtotal (True by default) * show_subtotal > Enable/Disable show subtotal (True by default)
* auto_save > Enable/Disable auto save (False 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 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 will lose part of its functionality as the document will be saved every time you

View File

@ -42,6 +42,7 @@ Widget options:
* show_discount > Enable/Disable display discount (False by default) * show_discount > Enable/Disable display discount (False by default)
* show_subtotal > Enable/Disable show subtotal (True by default) * show_subtotal > Enable/Disable show subtotal (True by default)
* auto_save > Enable/Disable auto save (False 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 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 will lose part of its functionality as the document will be saved every time you

View File

@ -471,6 +471,8 @@ You need to define the view fields. The view must be of <tt class="docutils lite
<li><p class="first">show_subtotal &gt; Enable/Disable show subtotal (True by default)</p> <li><p class="first">show_subtotal &gt; Enable/Disable show subtotal (True by default)</p>
</li> </li>
<li><p class="first">auto_save &gt; Enable/Disable auto save (False by default)</p> <li><p class="first">auto_save &gt; Enable/Disable auto save (False by default)</p>
</li>
<li><p class="first">all_domain &gt; The domain used in All section ([] by default)</p>
<p>If using auto save feature, you should keep in mind that the “Save” and “Discard” buttons <p>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 will lose part of its functionality as the document will be saved every time you
modify/create a record with the widget.</p> modify/create a record with the widget.</p>

View File

@ -27,6 +27,7 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun
"click .oe_btn_lines": "_onClickLines", "click .oe_btn_lines": "_onClickLines",
"click .oe_btn_search_group": "_onClickSearchGroup", "click .oe_btn_search_group": "_onClickSearchGroup",
"search .oe_search_input": "_onSearch", "search .oe_search_input": "_onSearch",
"focusin .oe_search_input": "_onFocusInSearch",
"show.bs.dropdown .o_cp_buttons": "_onShowSearchDropdown", "show.bs.dropdown .o_cp_buttons": "_onShowSearchDropdown",
}), }),
custom_events: _.extend({}, FieldOne2Many.prototype.custom_events, { custom_events: _.extend({}, FieldOne2Many.prototype.custom_events, {
@ -196,7 +197,7 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun
this.searchGroups.splice(0, 0, { this.searchGroups.splice(0, 0, {
name: "all", name: "all",
string: _t("All"), string: _t("All"),
domain: [], domain: this.options.all_domain,
order: false, order: false,
active: !hasUserActive, active: !hasUserActive,
}); });
@ -545,6 +546,7 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun
}, },
auto_save: false, auto_save: false,
ignore_warning: false, ignore_warning: false,
all_domain: [],
}; };
}, },
@ -681,6 +683,16 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun
}); });
}, },
/**
* Auto select all content when user enters into fields with this
* widget.
*
* @private
*/
_onFocusInSearch: function() {
this.$searchInput.select();
},
/** /**
* @private * @private
* @param {DropdownEvent} evt * @param {DropdownEvent} evt