mirror of https://github.com/OCA/web.git
[IMP] web_widget_one2many_product_picker: Remove items in main lines
parent
6a0a5d988b
commit
d97de8920b
|
@ -4,7 +4,7 @@
|
|||
{
|
||||
'name': 'Web Widget One2Many Product Picker',
|
||||
'summary': 'Widget to select products on one2many fields',
|
||||
'version': '12.0.1.1.0',
|
||||
'version': '12.0.1.1.2',
|
||||
'category': 'Website',
|
||||
'author': "Tecnativa, "
|
||||
"Odoo Community Association (OCA)",
|
||||
|
|
|
@ -38,6 +38,7 @@ odoo.define("web_widget_one2many_product_picker.One2ManyProductPickerRenderer",
|
|||
this.options = parent.options;
|
||||
this.mode = parent.mode;
|
||||
this.search_data = parent._searchRecords;
|
||||
this.search_group = parent._activeSearchGroup;
|
||||
this.last_search_data_count = parent._lastSearchRecordsCount;
|
||||
},
|
||||
|
||||
|
@ -75,9 +76,10 @@ odoo.define("web_widget_one2many_product_picker.One2ManyProductPickerRenderer",
|
|||
/**
|
||||
* @param {Object} search_data
|
||||
*/
|
||||
updateSearchData: function (search_data, count) {
|
||||
updateSearchData: function (search_data, count, search_group) {
|
||||
this.search_data = search_data;
|
||||
this.last_search_data_count = count;
|
||||
this.search_group = search_group;
|
||||
this._loadMoreWorking = false;
|
||||
this.$btnLoadMore.attr("disabled", false);
|
||||
},
|
||||
|
@ -128,6 +130,11 @@ odoo.define("web_widget_one2many_product_picker.One2ManyProductPickerRenderer",
|
|||
}
|
||||
this.widgets = _.compact(this.widgets);
|
||||
|
||||
if (this.search_group.name === "main_lines") {
|
||||
_.invoke(to_destroy, "destroy");
|
||||
return $.when();
|
||||
}
|
||||
|
||||
// If doesn't exists other records with the same product, we need
|
||||
// create a 'pure virtual' record again.
|
||||
for (var index_destroy in to_destroy) {
|
||||
|
|
|
@ -356,7 +356,8 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun
|
|||
if (self.renderer) {
|
||||
self.renderer.updateSearchData(
|
||||
self._searchRecords,
|
||||
self._lastSearchRecordsCount
|
||||
self._lastSearchRecordsCount,
|
||||
self._activeSearchGroup
|
||||
);
|
||||
}
|
||||
d.resolve(results);
|
||||
|
|
Loading…
Reference in New Issue