From 32701aa512cb0c382154d030436ca4d265e6e27f Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Tue, 2 Jan 2018 12:18:26 +0100 Subject: [PATCH] [FIX] website: menus with null URL would throw an error on display Before this commit, if a website.menu had a URL set to null, it would throw an error when displaying that menu. It is normally not possible to do so in v11 but after a migration, menus can be empty. (eg: Using an empty menu to display a divider in a dropdown menu) Now we return an empty url instead of an error --- 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 a4848313a9c..1b63929759e 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -815,7 +815,7 @@ class Menu(models.Model): url = self.page_id.sudo().url else: url = self.url - if not self.url.startswith('/'): + if url and not self.url.startswith('/'): if '@' in self.url: if not self.url.startswith('mailto'): url = 'mailto:%s' % self.url