[FIX] website: search pages in the menu creation dialog

The revision
8f48baeda6

broke the ability to search pages in the dialog
allowing to add a menu to the website from the website
(From the website, Content > Edit menu)
as `request.website` was not defined in this case

opw-702020
This commit is contained in:
Denis Ledoux
2016-12-21 14:59:29 +01:00
parent 88a9ee2565
commit a98d60cb11
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -345,7 +345,8 @@ class PageConverter(werkzeug.routing.PathConverter):
query = query and query.startswith('website.') and query[8:] or query
if query:
domain += [('key', 'like', query)]
domain += ['|', ('website_id', '=', request.website.id), ('website_id', '=', False)]
website_id = request.context.get('website_id') or request.registry['website'].search(cr, uid, [], limit=1)[0]
domain += ['|', ('website_id', '=', website_id), ('website_id', '=', False)]
views = View.search_read(cr, uid, domain, fields=['key', 'priority', 'write_date'], order='name', context=context)
for view in views:
+1
View File
@@ -511,6 +511,7 @@ class website(osv.osv):
of the same.
:rtype: list({name: str, url: str})
"""
request.context = dict(request.context, **context)
router = request.httprequest.app.get_db_router(request.db)
# Force enumeration to be performed as public user
url_set = set()