From 5033fdbe94869609a16c729a7fa973e840cd6637 Mon Sep 17 00:00:00 2001 From: FrancoisGe Date: Tue, 24 Oct 2023 10:18:23 +0200 Subject: [PATCH] [REM] survey: remove obsolete patch on X2ManyFieldDialog Since commit e17c2135cb24aa600eeff9426b93665537a33d00, if an error is thrown during the "save" of X2ManyFieldDialog, the buttons are enabled(). So the patch on X2ManyFieldDialog in question_page_one2many_field.js is no longer useful. So we're going to remove it. closes odoo/odoo#139550 Signed-off-by: Aaron Bohy (aab) --- .../question_page_one2many_field.js | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/addons/survey/static/src/question_page/question_page_one2many_field.js b/addons/survey/static/src/question_page/question_page_one2many_field.js index 07b509a706b..f44e573c0bb 100644 --- a/addons/survey/static/src/question_page/question_page_one2many_field.js +++ b/addons/survey/static/src/question_page/question_page_one2many_field.js @@ -3,30 +3,10 @@ import { _t } from "@web/core/l10n/translation"; import { QuestionPageListRenderer } from "./question_page_list_renderer"; import { registry } from "@web/core/registry"; -import { useOpenX2ManyRecord, useX2ManyCrud, X2ManyFieldDialog } from "@web/views/fields/relational_utils"; -import { patch } from '@web/core/utils/patch'; +import { useOpenX2ManyRecord, useX2ManyCrud } from "@web/views/fields/relational_utils"; import { X2ManyField, x2ManyField } from "@web/views/fields/x2many/x2many_field"; import { useSubEnv } from "@odoo/owl"; -patch(X2ManyFieldDialog.prototype, { - /** - * Re-enable buttons after our error is thrown because blocking normal - * behavior is required to not close the dialog and stay in edition but - * the buttons are required to try and save again after changing form data. - * - * @override - */ - async saveAndNew() { - const res = super.saveAndNew(...arguments); - if (this.record.resModel === 'survey.question') { - const btns = this.modalRef.el.querySelectorAll(".modal-footer button"); // see XManyFieldDialog.disableButtons - this.enableButtons(btns); - } - return res; - } -}); - - /** * For convenience, we'll prevent closing the question form dialog and * stay in edit mode to make sure only valid records are saved. Therefore,