[MERGE]Latest trunk

bzr revid: dle@openerp.com-20121220184553-rtm9y36uziy2gqld
This commit is contained in:
dle@openerp.com 2012-12-20 19:45:53 +01:00
commit 84e2b28108
3 changed files with 9 additions and 7 deletions

View File

@ -245,11 +245,17 @@ class res_users(osv.Model):
# send email to users with their signup url
template = self.pool.get('ir.model.data').get_object(cr, uid, 'auth_signup', 'reset_password_email')
mail_obj = self.pool.get('mail.mail')
assert template._name == 'email.template'
for user in self.browse(cr, uid, ids, context):
if not user.email:
raise osv.except_osv(_("Cannot send email: user has no email address."), user.name)
self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, True, context=context)
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':
raise osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name)
else:
raise osv.except_osv(_("Mail sent to:"), user.email)
return True

View File

@ -19,16 +19,12 @@
</header>
</xpath>
<!-- add Reset Password button -->
<xpath expr="//sheet/*[1]" position="before">
<xpath expr="//div[@class='oe_right oe_button_box']" position="replace">
<div class="oe_right oe_button_box">
<button string="Reset Password" type="object" name="action_reset_password"
help="Send an email to the user to (re)set their password."/>
</div>
</xpath>
<!-- hide field set_password -->
<field name="new_password" position="replace">
<field name="new_password" groups="base.group_no_one" password="True"/>
</field>
</field>
</record>

View File

@ -25,7 +25,7 @@
and
</span>
<field name="partner_ids" widget="many2many_tags_email" placeholder="Add contacts to notify..."
context="{'force_email':True}"/>
context="{'force_email':True, 'show_email':True}"/>
</div>
<field name="subject" placeholder="Subject..."/>
</group>