[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:

<field name="domain_force">[('website_published', '=', True)]</field>

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.
This commit is contained in:
rde
2017-09-27 21:33:49 +02:00
committed by Jeremy Kersten
parent 1b52b00d2a
commit fa23bb8586
+1 -1
View File
@@ -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('/'):