[IMP] res_users: use current users' language and timezone as defaults for users

bzr revid: rco@openerp.com-20120419142114-glz51xj6ozubl07k
This commit is contained in:
Raphael Collet 2012-04-19 16:21:14 +02:00
parent 0d944fff3c
commit 7d9a253df4
1 changed files with 9 additions and 2 deletions

View File

@ -361,10 +361,17 @@ class users(osv.osv):
# default avatar file name: avatar0 -> avatar6.png, choose randomly
avatar_path = openerp.modules.get_module_resource('base', 'static/src/img', 'avatar%d.png' % random.randint(0, 6))
return self._avatar_resize(cr, uid, open(avatar_path, 'rb').read().encode('base64'), context=context)
def _get_context_lang(self, cr, uid, context=None):
return self.browse(cr, uid, uid).context_lang
def _get_context_tz(self, cr, uid, context=None):
return self.browse(cr, uid, uid).context_tz
_defaults = {
'password' : '',
'context_lang': 'en_US',
'context_lang': _get_context_lang,
'context_tz': _get_context_tz,
'avatar': _get_avatar,
'active' : True,
'menu_id': _get_menu,