[IMP] auth_signup: add state (function field) on res.users: new, active, resetting password
bzr revid: rco@openerp.com-20121002145757-2m4dj7t5zq2sztfc
This commit is contained in:
parent
b3e7f809b2
commit
295e96d528
|
@ -34,6 +34,7 @@ Allow users to sign up.
|
|||
'data': [
|
||||
'auth_signup_data.xml',
|
||||
'res_config.xml',
|
||||
'res_users_view.xml',
|
||||
],
|
||||
'js': ['static/src/js/auth_signup.js'],
|
||||
'css' : ['static/src/css/base.css'],
|
||||
|
|
|
@ -137,6 +137,15 @@ class res_partner(osv.Model):
|
|||
class res_users(osv.Model):
|
||||
_inherit = 'res.users'
|
||||
|
||||
def _get_state(self, cr, uid, ids, name, arg, context=None):
|
||||
return dict((user.id, 'new' if not user.login_date else 'reset' if user.signup_token else 'active')
|
||||
for user in self.browse(cr, uid, ids, context))
|
||||
|
||||
_columns = {
|
||||
'state': fields.function(_get_state, string='State', type='selection',
|
||||
selection=[('new', 'New'), ('active', 'Active'), ('reset', 'Resetting Password')]),
|
||||
}
|
||||
|
||||
def signup(self, cr, uid, values, token=None, context=None):
|
||||
""" signup a user, to either:
|
||||
- create a new user (no token), or
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="res_users_form_view" model="ir.ui.view">
|
||||
<field name="name">user.form.state</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//sheet" position="before">
|
||||
<header>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue