Skip to content
Snippets Groups Projects
Commit 8f30a4bb authored by Ivan Yelizariev's avatar Ivan Yelizariev
Browse files

[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#92344

Signed-off-by: default avatarSamuel Degueldre <sad@odoo.com>
parent a4cce9a8
No related branches found
No related tags found
No related merge requests found
/** @odoo-module */
import { ErrorDialog } from "@web/core/errors/error_dialogs";
import { RPCErrorDialog } from "@web/core/errors/error_dialogs";
import session from "web.session";
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;
......@@ -50,6 +50,7 @@ export class BaseAutomationErrorDialog extends ErrorDialog {
views: [[false, "form"]],
type: "ir.actions.act_window",
view_mode: "form",
target: "new",
});
this.close();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment