Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion base_exception/static/src/js/base_exception.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ async function popUpException(env, _action) {
// Do a soft reload before displaying the popup to display the exception
// on the Form view
await env.services.action.restore(controller.jsId);
await env.services.action.doAction(popupAction);
await env.services.action.doAction(popupAction, {
onClose: () =>
env.services.action.doAction({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering, shouldn't we instead do the soft reload before the popup is opened?

AFAIU we could modify the error handler below instead and do this at line 25:

        const excData = JSON.parse(originalError.data.message);
        env.services.action.doAction({
            type: "ir.actions.client",
            tag: "soft_reload",
        });
        if (excData.target_model === controller.props.resModel) {
            env.services.action.doAction({
                type: "ir.actions.client",
                tag: "popup_exception",
            });
        } 
        return true;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grindtildeath the soft reload before the popup is already there — action.restore(controller.jsId) a couple of lines above, that's what makes the exception show up on the form.

What this PR fixes happens after: the dialog can confirm the record (Ignore Exceptions + Confirm runs action_ignore_exceptions() + action_confirm()), so when it closes the order is already state=sale while the form still shows the quotation and the exception banner. A reload before the popup can't reflect a change that hasn't happened yet.

I tried both on 18.0 with a non-blocking rule: with the reload moved to the handler, the form stays on "Quotation" with the banner while the record is confirmed in DB — same as without the fix. With onClose it reloads as expected.

type: "ir.actions.client",
tag: "soft_reload",
}),
});
}

function baseExceptionErrorHandler(env, uncaughtError, originalError) {
Expand Down
Loading