| 1 |
import { patch } from "@web/core/utils/patch"; |
| 2 |
import { actionService } from "@web/webclient/actions/action_service"; |
| 3 |
|
| 4 |
patch(actionService, { |
| 5 |
start(env) { |
| 6 |
// The action service wants to open the majority of links in the main container, not in new dialog. |
| 7 |
// The problem is that in pos we don't have the main container, so the links are simply not opened. |
| 8 |
// This is a workaround to always open links in new dialogs. |
| 9 |
const superReturn = super.start(env); |
| 10 |
return { |
| 11 |
...superReturn, |
| 12 |
doAction: async (actionRequest, options = {}) => { |
| 13 |
if ( |
| 14 |
document.body.classList.contains("modal-open") && |
| 15 |
typeof actionRequest === "object" |
| 16 |
) { |
| 17 |
actionRequest.target = "new"; |
| 18 |
} |
| 19 |
return superReturn.doAction(actionRequest, options); |
| 20 |
}, |
| 21 |
}; |
| 22 |
}, |
| 23 |
}); |