res.users: fix default menu_id, after models got sorted by name.

With the old sorting behavior, id=1 would be the first menu to appear.
But, after sorting, the alphabetically first ("accounting dashboard")
replaced the main menu!

bzr revid: p_christ@hol.gr-20101214162919-o9xflsed4ap6hn2z
This commit is contained in:
P. Christeas 2010-12-14 18:29:19 +02:00
parent 66564a93fc
commit 40cf6eac7a
1 changed files with 8 additions and 2 deletions

View File

@ -299,8 +299,14 @@ class users(osv.osv):
return False
def _get_menu(self,cr, uid, context=None):
ids = self.pool.get('ir.actions.act_window').search(cr, uid, [('usage','=','menu')], context=context)
return ids and ids[0] or False
dataobj = self.pool.get('ir.model.data')
try:
model, res_id = dataobj.get_object_reference(cr, uid, 'base', 'action_menu_admin')
if model != 'ir.actions.act_window':
return False
return res_id
except ValueError:
return False
def _get_group(self,cr, uid, context=None):
dataobj = self.pool.get('ir.model.data')