def _get_state(self, cr, uid, ids, name, arg, context=None):
res = {}
for user in self.browse(cr, uid, ids, context):
- res[user.id] = ('reset' if user.signup_valid and user.login_date else
- 'active' if user.login_date else
- 'new')
+ res[user.id] = ('active' if user.login_date else 'new')
return res
_columns = {
'state': fields.function(_get_state, string='Status', type='selection',
- selection=[('new', 'Never Connected'), ('active', 'Activated'), ('reset', 'Invitation Pending')]),
+ selection=[('new', 'Never Connected'), ('active', 'Activated')]),
}
def signup(self, cr, uid, values, token=None, context=None):
<header>
<field name="state" widget="statusbar"/>
</header>
- <div class="oe_form_box_info oe_text_center" attrs="{'invisible': ['|', ('state', '!=', 'reset'), ('state', '!=', 'new'), ('signup_valid', '!=', True)]}">
- <p attrs="{'invisible': [('state', '!=', 'reset')]}">
+ <div class="oe_form_box_info oe_text_center" attrs="{'invisible': [('signup_valid', '!=', True)]}">
+ <p attrs="{'invisible': [('state', '!=', 'active')]}">
<b>A password reset has been requested for this user. An email containing the following link has been sent:</b>
</p>
- <p attrs="{'invisible': ['|', ('state', '!=', 'new'), ('signup_valid', '!=', True)]}">
- <b>This user has not logged in yet. An invitation email has been sent with the following subscription link:</b>
+ <p attrs="{'invisible': [('state', '!=', 'new')]}">
+ <b>An invitation email has been sent to this user with the following subscription link:</b>
</p>
<p><field class="oe_inline" name="signup_url" widget="url"/></p>
<field name="signup_valid" invisible="1"/>
<xpath expr="//div[@class='oe_right oe_button_box']" position="replace">
<div class="oe_right oe_button_box">
<button string="Send reset password instructions by email"
- type="object" name="action_reset_password" />
- <!-- TODO: Send an invitation email -->
+ type="object" name="action_reset_password"
+ attrs="{'invisible': [('state', '!=', 'active')]}"/>
+ <button string="Send an invitation email"
+ type="object" name="action_reset_password"
+ attrs="{'invisible': [('state', '!=', 'new')]}"/>
</div>
</xpath>
</field>