[IMP] res_user: added _get_email_from function + improved user prefs view

bzr revid: odo@openerp.com-20100625172936-4khw7odv1sgu0xy6
This commit is contained in:
Olivier Dony 2010-06-25 19:29:36 +02:00
parent 93832f58e8
commit 541d14dca6
2 changed files with 15 additions and 7 deletions

View File

@ -85,14 +85,13 @@
<separator colspan="4" string="Preferences"/>
</page>
<page string="Preferences">
<field name="password" password="True" readonly="0"/>
<newline/>
<field name="password" password="True" readonly="0" colspan="4"/>
<label string="" colspan="1"/>
<label colspan="3" string="Please note that you will have to logout and relog if you change your password."/>
<label colspan="3" string="You must logout and login again after changing your password."/>
<field name="context_lang" completion="1" readonly="0"/>
<field name="context_tz" completion="1" readonly="0"/>
<newline/>
<separator string="Signature" colspan="4"/>
<separator string="Email &amp; Signature" colspan="4"/>
<group colspan="4"><field name="user_email" widget="email"/></group>
<field colspan="4" name="signature" readonly="0" nolabel="1"/>
</page>
</notebook>

View File

@ -265,7 +265,7 @@ class users(osv.osv):
result = override_password(result)
else:
result = map(override_password, result)
if isinstance(result, list):
for rec in result:
if not rec.get('action_id',True):
@ -273,7 +273,7 @@ class users(osv.osv):
else:
if not result.get('action_id',True):
result['action_id'] = (self._get_menu(cr, uid),'Menu')
return result
@ -288,6 +288,15 @@ class users(osv.osv):
('login_key', 'UNIQUE (login)', _('You can not have two users with the same login !'))
]
def _get_email_from(self, cr, uid, ids, context=None):
if not isinstance(ids, list):
ids = [ids]
res = dict.fromkeys(ids)
for user in self.browse(cr, uid, ids, context=context):
if user.user_email:
res[user.id] = "%s <%s>" % (user.name, user.user_email)
return res
def _get_admin_id(self, cr):
if self.__admin_ids.get(cr.dbname) is None:
ir_model_data_obj = self.pool.get('ir.model.data')