[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 <sad@odoo.com>
This commit is contained in:
Ivan Yelizariev
2022-11-21 11:50:23 +01:00
committed by Samuel Degueldre
parent 0cb185a126
commit 77911affbe
@@ -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();
}