From 247f7db08829919d25b5adaa3645b6341ca70ab0 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Thu, 8 Mar 2018 13:44:03 +0100 Subject: [PATCH] [FIX] website: use absolute href location after page url change Before this commit: When editing a page URL through page properties it would redirect to that new url afterward. If the url was not starting with '/' and had multiple level before and after edition (eg: page/action to page/realaction) it would then redirect to a wrong relative URL. Now, we ensure that we redirect to the correct URL: the one slugified and cleaned in the backend. Step to reproduce: - Create a page '/page/action' - Go to that page and open Page Properties - Edit the URL to 'page/someaction' - You will be redirected to the incorrect relative URL /page/page/someaction --- addons/website/models/website.py | 2 +- addons/website/static/src/js/menu/content.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 1cc7472f8e3..153d8578a3c 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -715,7 +715,7 @@ class Page(models.Model): 'website_id': website.id, }) - return True + return url @api.multi def copy(self, default=None): diff --git a/addons/website/static/src/js/menu/content.js b/addons/website/static/src/js/menu/content.js index 020ed362d2b..2221eba4024 100644 --- a/addons/website/static/src/js/menu/content.js +++ b/addons/website/static/src/js/menu/content.js @@ -198,7 +198,7 @@ var PagePropertiesDialog = widget.Dialog.extend({ kwargs: { context: context }, - }).then(function () { + }).then(function (url) { // If from page manager: reload url, if from page itself: go to (possibly) new url if (self._getMainObject().model == 'website.page') window.location.href = url.toLowerCase();