[FIX] auth_signup: automatically invite new users to set their password *only* when created from the users form view

bzr revid: rco@openerp.com-20121206093603-5zru6o160v20553h
This commit is contained in:
Raphael Collet 2012-12-06 10:36:03 +01:00
parent 5122dab978
commit 11b3bbce1c
2 changed files with 6 additions and 1 deletions

View File

@ -254,6 +254,6 @@ class res_users(osv.Model):
# overridden to automatically invite user to sign up
user_id = super(res_users, self).create(cr, uid, values, context=context)
user = self.browse(cr, uid, user_id, context=context)
if user.email:
if context and context.get('reset_password') and user.email:
user.action_reset_password()
return user_id

View File

@ -2,6 +2,11 @@
<openerp>
<data>
<!-- add context in action to enable automatic reset password -->
<record id="base.action_res_users" model="ir.actions.act_window">
<field name="context">{'reset_password': True}</field>
</record>
<record id="res_users_form_view" model="ir.ui.view">
<field name="name">user.form.state</field>
<field name="model">res.users</field>