From ed57d1cfad9376bf8cc554dab44cf170cded92d3 Mon Sep 17 00:00:00 2001 From: luvi Date: Sun, 9 Oct 2022 15:57:29 +0000 Subject: [PATCH] [FIX] website: redirect to new page after action create This commit fixes the behavior of the website app when creating content. Since commit (1), once a new record was created, it was no longer redirected to the correct page. Now, this behavior is reintroduced and works as expected. (1): https://github.com/odoo/odoo/commit/916a5bebb3e74047a66503ddc59299540c252831 closes odoo/odoo#102959 X-original-commit: 7cfe4523d18989b0273a026000109617bbfb2d13 Signed-off-by: Quentin Smetz (qsm) --- .../src/components/views/page_views_mixin.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/addons/website/static/src/components/views/page_views_mixin.js b/addons/website/static/src/components/views/page_views_mixin.js index 23d3fe2d23b..87feeae3b7e 100644 --- a/addons/website/static/src/components/views/page_views_mixin.js +++ b/addons/website/static/src/components/views/page_views_mixin.js @@ -48,11 +48,22 @@ export const PageControllerMixin = (component) => class extends component { return; } this.actionService.doAction(action, { - onClose: (data) => { - if (data) { - this.website.goToWebsite({path: data.path}); + onClose: (infos) => { + if (infos) { + this.website.goToWebsite({ path: infos.path }); } }, + props: { + onSave: (record, params) => { + if (record.resId && params.computePath) { + const path = params.computePath(); + this.actionService.doAction({ + type: "ir.actions.act_window_close", + infos: { path } + }); + } + } + } }); } }