From 77911affbef83ff4278a4623ee8b6e914b2e949e Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Fri, 27 May 2022 09:44:04 +0000 Subject: [PATCH] [FIX] base_automation: fix rpc error handling RPC call may fail because of error in `base.automation` handler. In this case the response contains attribute `exception_class=base_automation` to handle error via custom dialog `BaseAutomationErrorDialog`, which provides extra buttons (disable/edit Automated Action). 1. `BaseAutomationErrorDialog` was incorrectly inherited from ErrorDialog, which cannot extract traceback from `data.debug` value of jsonrpc. Fix it by replacing it RPCErrorDialog. RPCErrorDialog: https://github.com/odoo/odoo/blob/a75fcbe03f31fd10a74e609672b64dad165e68d7/addons/web/static/src/core/errors/error_dialogs.js#L62-L70 2. Button `Edit Action` didn't work, because it tries the same rpc call before navigating to the action. For example, it would repeat rpc call to create a record, which doesn't work because of broken automated action. It happens because form changes are saved automatically since Odoo v15. Fix it by adding `target: "new"`. opw-2845893 closes odoo/odoo#106134 X-original-commit: f54eef302323f1f6406e9b2ac8e02cec5b627fac Signed-off-by: Samuel Degueldre --- .../static/src/js/base_automation_error_dialog.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/base_automation/static/src/js/base_automation_error_dialog.js b/addons/base_automation/static/src/js/base_automation_error_dialog.js index b3f19dd2528..971f6eeafe1 100644 --- a/addons/base_automation/static/src/js/base_automation_error_dialog.js +++ b/addons/base_automation/static/src/js/base_automation_error_dialog.js @@ -1,10 +1,10 @@ /** @odoo-module */ -import { ErrorDialog } from "@web/core/errors/error_dialogs"; +import { RPCErrorDialog } from "@web/core/errors/error_dialogs"; import { registry } from "@web/core/registry"; import { useService } from "@web/core/utils/hooks"; -export class BaseAutomationErrorDialog extends ErrorDialog { +export class BaseAutomationErrorDialog extends RPCErrorDialog { setup() { super.setup(...arguments); const { id, name } = this.props.data.context.base_automation; @@ -49,6 +49,7 @@ export class BaseAutomationErrorDialog extends ErrorDialog { views: [[false, "form"]], type: "ir.actions.act_window", view_mode: "form", + target: "new", }); this.props.close(); }