From 44659d5e0bd8c7511cba47e1edc8631bc9957f15 Mon Sep 17 00:00:00 2001 From: Simone Rubino Date: Thu, 8 Feb 2024 15:56:06 +0100 Subject: [PATCH] [FIX] product_configurator: Wizard reset --- product_configurator/__manifest__.py | 1 + .../static/src/js/form_controller.esm.js | 14 ++++++++++++++ product_configurator/static/src/js/form_widgets.js | 8 -------- 3 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 product_configurator/static/src/js/form_controller.esm.js diff --git a/product_configurator/__manifest__.py b/product_configurator/__manifest__.py index e26e5b634f..e306564f9d 100644 --- a/product_configurator/__manifest__.py +++ b/product_configurator/__manifest__.py @@ -28,6 +28,7 @@ "assets": { "web.assets_backend": [ "/product_configurator/static/src/scss/form_widget.scss", + "/product_configurator/static/src/js/form_controller.esm.js", "/product_configurator/static/src/js/form_widgets.js", "/product_configurator/static/src/js/boolean_button_widget.esm.js", "/product_configurator/static/src/js/boolean_button_widget.xml", diff --git a/product_configurator/static/src/js/form_controller.esm.js b/product_configurator/static/src/js/form_controller.esm.js new file mode 100644 index 0000000000..398fbd0147 --- /dev/null +++ b/product_configurator/static/src/js/form_controller.esm.js @@ -0,0 +1,14 @@ +/** @odoo-module **/ + +import {FormController} from "@web/views/form/form_controller"; +import {patch} from "@web/core/utils/patch"; + +patch(FormController.prototype, "Manage special=no_save", { + async beforeExecuteActionButton(clickParams) { + if (clickParams.special === "no_save") { + delete clickParams.special; + return true; + } + return this._super(...arguments); + }, +}); diff --git a/product_configurator/static/src/js/form_widgets.js b/product_configurator/static/src/js/form_widgets.js index b45e17f26f..6c48549259 100644 --- a/product_configurator/static/src/js/form_widgets.js +++ b/product_configurator/static/src/js/form_widgets.js @@ -37,14 +37,6 @@ odoo.define("product_configurator.FieldBooleanButton", function (require) { record_ctx ); } - if (attrs.special === "no_save") { - this.canBeSaved = function () { - return true; - }; - var event_no_save = $.extend(true, {}, event); - event_no_save.data.attrs.special = false; - return this._super(event_no_save); - } this._super(event); }, });