[FIX] navbar cache: do not use ormcache as it does not handle kwargs. instead, only get the root menu_ids in rendering context
This commit is contained in:
parent
839a70511c
commit
2870af3b49
|
@ -184,7 +184,7 @@
|
||||||
<template id="web.menu_link">
|
<template id="web.menu_link">
|
||||||
<t t-set="debug_param" t-value="'?&debug=' if debug else ''"/>
|
<t t-set="debug_param" t-value="'?&debug=' if debug else ''"/>
|
||||||
<a t-att-href="'/web%s#menu_id=%s&action=%s' % (debug_param, menu['id'], menu['action'] and menu['action'].split(',')[1] or '')"
|
<a t-att-href="'/web%s#menu_id=%s&action=%s' % (debug_param, menu['id'], menu['action'] and menu['action'].split(',')[1] or '')"
|
||||||
t-att-class="'oe_menu_toggler' if menu['children'] else 'oe_menu_leaf'"
|
t-att-class="'oe_menu_toggler' if menu.get('children') else 'oe_menu_leaf'"
|
||||||
t-att-data-menu="menu['id']"
|
t-att-data-menu="menu['id']"
|
||||||
t-att-data-action-model="menu['action'] and menu['action'].split(',')[0] or ''"
|
t-att-data-action-model="menu['action'] and menu['action'].split(',')[0] or ''"
|
||||||
t-att-data-action-id="menu['action'] and menu['action'].split(',')[1] or ''">
|
t-att-data-action-id="menu['action'] and menu['action'].split(',')[1] or ''">
|
||||||
|
|
|
@ -151,7 +151,7 @@ class view(osv.osv):
|
||||||
user_id=self.pool.get("res.users").browse(cr, uid, uid),
|
user_id=self.pool.get("res.users").browse(cr, uid, uid),
|
||||||
translatable=context.get('lang') != request.website.default_lang_code,
|
translatable=context.get('lang') != request.website.default_lang_code,
|
||||||
editable=request.website.is_publisher(),
|
editable=request.website.is_publisher(),
|
||||||
menu_data=self.pool['ir.ui.menu'].load_menus(cr, uid, context=context) if request.website.is_user() else None,
|
menu_data=self.pool['ir.ui.menu'].load_menus_root(cr, uid, context=context) if request.website.is_user() else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
# add some values
|
# add some values
|
||||||
|
|
|
@ -349,7 +349,18 @@ class ir_ui_menu(osv.osv):
|
||||||
menu_domain = [('parent_id', '=', False)]
|
menu_domain = [('parent_id', '=', False)]
|
||||||
return self.search(cr, uid, menu_domain, context=context)
|
return self.search(cr, uid, menu_domain, context=context)
|
||||||
|
|
||||||
@tools.ormcache()
|
def load_menus_root(self, cr, uid, context=None):
|
||||||
|
fields = ['name', 'sequence', 'parent_id', 'action']
|
||||||
|
menu_root_ids = self.get_user_roots(cr, uid, context=context)
|
||||||
|
menu_roots = self.read(cr, uid, menu_root_ids, fields, context=context) if menu_root_ids else []
|
||||||
|
return {
|
||||||
|
'id': False,
|
||||||
|
'name': 'root',
|
||||||
|
'parent_id': [-1, ''],
|
||||||
|
'children': menu_roots,
|
||||||
|
'all_menu_ids': menu_root_ids,
|
||||||
|
}
|
||||||
|
|
||||||
def load_menus(self, cr, uid, context=None):
|
def load_menus(self, cr, uid, context=None):
|
||||||
""" Loads all menu items (all applications and their sub-menus).
|
""" Loads all menu items (all applications and their sub-menus).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue