From c8f718cc3a2548a1b76e128a401d5e0026eccac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=2E=20D=C3=ADaz?= Date: Wed, 10 Feb 2021 20:15:08 +0100 Subject: [PATCH] [IMP] web_widget_one2many_product_picker: Only 'auto' save if has changes --- .../One2ManyProductPicker/quick_create_form_view.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/quick_create_form_view.js b/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/quick_create_form_view.js index 23c3b2501..80218e41e 100644 --- a/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/quick_create_form_view.js +++ b/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/quick_create_form_view.js @@ -18,6 +18,8 @@ odoo.define("web_widget_one2many_product_picker.ProductPickerQuickCreateFormView BasicModel.include({ _applyOnChange: function (values, record, viewType) { + var vt = viewType || record.viewType; + // Ignore changes by record context 'ignore_onchanges' fields if ('ignore_onchanges' in record.context) { var ignore_changes = record.context.ignore_onchanges; for (var index in ignore_changes) { @@ -64,9 +66,13 @@ odoo.define("web_widget_one2many_product_picker.ProductPickerQuickCreateFormView }, /** - * Automatically create or accept changes + * Create or accept changes */ auto: function () { + var record = this.model.get(this.handle); + if (record.context.has_changes_confirmed || typeof record.context.has_changes_confirmed === "undefined") { + return; + } var state = this._getRecordState(); if (state === "new") { this._add(); @@ -342,6 +348,9 @@ odoo.define("web_widget_one2many_product_picker.ProductPickerQuickCreateFormView Controller: ProductPickerQuickCreateFormController, }), + /** + * @override + */ init: function (viewInfo, params) { this._super.apply(this, arguments); this.controllerParams.compareKey = params.compareKey;