[FIX] web_widget_one2many_product_picker: Don't save in 'refresh' time

(cherry picked from commit aca8ae4217)
This commit is contained in:
Alexandre D. Díaz
2022-04-01 19:44:22 +02:00
committed by Daniel Reis
parent 0c2be8f166
commit 316cb0a0f5
2 changed files with 25 additions and 2 deletions

View File

@@ -98,6 +98,9 @@ odoo.define(
},
canBeUpdated: function() {
if (!this.getParent()) {
return false;
}
var model = this.getParent().getBasicFieldParams().model;
for (var widget of this.widgets) {
if (!widget.state) {
@@ -148,7 +151,10 @@ odoo.define(
});
},
getWidgetsWithoutOnchange: function(product_id) {
getWidgetsWithoutOnchange: function() {
if (!this.getParent()) {
return false;
}
var model = this.getParent().getBasicFieldParams().model;
return _.filter(this.widgets, function(item) {
return (

View File

@@ -809,7 +809,12 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun
*/
_saveDocument: function(ids_to_update) {
var widgets = this.renderer.getWidgetsWithoutOnchange();
if (!_.isEmpty(this._ids_to_wait) || _.isEmpty(ids_to_update) || !_.isEmpty(widgets)) {
if (
widgets === false ||
!_.isEmpty(this._ids_to_wait) ||
_.isEmpty(ids_to_update) ||
!_.isEmpty(widgets)
) {
return this._saveChain;
}
var self = this;
@@ -1135,11 +1140,23 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun
_onResumeAutoSave: function() {
// Check if can resume
<<<<<<< HEAD
if (this.$('.oe_product_picker_quick_modif_price').is(':visible') || this.$('.oe_search_input').is(':focus') || this.$('.oe_flip_card.active').length) {
=======
if (
!this._is_auto_save_paused ||
this.$(".oe_product_picker_quick_modif_price").is(":visible") ||
this.$(".oe_search_input").is(":focus") ||
this.$(".oe_flip_card.active").length
) {
>>>>>>> aca8ae42 ([FIX] web_widget_one2many_product_picker: Don't save in 'refresh' time)
return;
}
if (this._need_resume_auto_save) {
if (this._auto_save_timeout) {
clearTimeout(this._auto_save_timeout);
}
this._auto_save_timeout = setTimeout(
this._saveDocument.bind(this),
this.options.auto_save_delay,