From fa23bb85863c2777689e76e517685db44ab4df9a Mon Sep 17 00:00:00 2001 From: rde Date: Wed, 27 Sep 2017 10:56:19 +0200 Subject: [PATCH] [FIX] website: unpublished page present in menu throws an error if public user Before this commit, an unpublished page present in menu would throw an error for public user (group_portal & group_public) because of the security record rule set on website.page model not allowing read access to unpublished pages: [('website_published', '=', True)] In this particular case, we try to retrieve the menu URL, but since the URL is retrieved through its (m2o) website.page, it would cause an error. Now, it the menu has a website.page unpublished, we will correctly retrieve its URL (sudo) and it won't crash. --- addons/website/models/website.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 6af04e20986..797825c9131 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -705,7 +705,7 @@ class Menu(models.Model): def clean_url(self): # clean the url with heuristic if self.page_id: - url = self.page_id.url + url = self.page_id.sudo().url else: url = self.url if not self.url.startswith('/'):