From 8a27d3d138dfea25b09d891bcbad4fccdd2c718a Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Wed, 2 Jan 2013 11:18:05 +0100 Subject: [PATCH] [IMP] Show notification when sending a reset password mail bzr revid: vta@openerp.com-20130102101805-xnh9ixoo8b3yc14i --- addons/auth_signup/res_users.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index f57fa4cb7ca..5c558ca68d7 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -249,14 +249,22 @@ class res_users(osv.Model): assert template._name == 'email.template' for user in self.browse(cr, uid, ids, context): if not user.email: - m = osv.except_osv(_("Cannot send email: user has no email address."), user.name) + raise osv.except_osv(_("Cannot send email: user has no email address."), user.name) mail_id = self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, True, context=context) mail_state = mail_obj.read(cr, uid, mail_id, ['state'], context=context) - if mail_state and mail_state == 'exception': - m = osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name) + if mail_state and mail_state['state'] == 'exception': + raise osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name) else: - m = osv.except_osv(_("Mail sent to:"), user.email) - return True + return { + 'type': 'ir.actions.client', + 'name': '_(Server Notification)', + 'tag': 'action_notify', + 'params': { + 'title': 'Mail Sent to: %s' % user.name, + 'text': 'You can reset the password by yourself using this link' % user.partner_id.signup_url, + 'sticky': True, + } + } def create(self, cr, uid, values, context=None): # overridden to automatically invite user to sign up