if user_ids is None:
user_ids = [uid]
partner_ids = [user.partner_id.id for user in self.pool.get('res.users').browse(cr, uid, user_ids, context=context)]
- return self.message_subscribe(cr, uid, ids, partner_ids, subtype_ids=subtype_ids, context=context)
+ result = self.message_subscribe(cr, uid, ids, partner_ids, subtype_ids=subtype_ids, context=context)
+ if partner_ids and result:
+ self.pool['ir.ui.menu'].clear_cache()
+ return result
def message_subscribe(self, cr, uid, ids, partner_ids, subtype_ids=None, context=None):
""" Add partners to the records followers. """
if user_ids is None:
user_ids = [uid]
partner_ids = [user.partner_id.id for user in self.pool.get('res.users').browse(cr, uid, user_ids, context=context)]
- return self.message_unsubscribe(cr, uid, ids, partner_ids, context=context)
+ result = self.message_unsubscribe(cr, uid, ids, partner_ids, context=context)
+ if partner_ids and result:
+ self.pool['ir.ui.menu'].clear_cache()
+ return result
def message_unsubscribe(self, cr, uid, ids, partner_ids, context=None):
""" Remove partners from the records followers. """
# but since we do not use it, set it by ourself.
self.pool._any_cache_cleared = True
self._menu_cache.clear()
+ self.load_menus_root._orig.clear_cache(self)
+ self.load_menus._orig.clear_cache(self)
@api.multi
@api.returns('self')
menu_domain = [('parent_id', '=', False)]
return self.search(cr, uid, menu_domain, context=context)
+ @api.cr_uid_context
+ @tools.ormcache_context(accepted_keys=('lang',))
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)
'all_menu_ids': menu_root_ids,
}
+
+ @api.cr_uid_context
+ @tools.ormcache_context(accepted_keys=('lang',))
def load_menus(self, cr, uid, context=None):
""" Loads all menu items (all applications and their sub-menus).
_('The name of the group can not start with "-"'))
res = super(res_groups, self).write(cr, uid, ids, vals, context=context)
self.pool['ir.model.access'].call_cache_clearing_methods(cr)
+ self.pool['res.users'].has_group.clear_cache(self.pool['res.users'])
return res
class res_users(osv.osv):
if id in self._uid_cache[db]:
del self._uid_cache[db][id]
self.context_get.clear_cache(self)
+ self.has_group.clear_cache(self)
return res
def unlink(self, cr, uid, ids, context=None):
'target': 'new',
}
+ @tools.ormcache(skiparg=2)
def has_group(self, cr, uid, group_ext_id):
"""Checks whether user belongs to given group.