[IMP] add a template user to the portal and use it as default value in the external users config
bzr revid: abo@openerp.com-20120828124754-j2b5m7m58pdv6k0y
This commit is contained in:
parent
b932099921
commit
2606c563c4
|
@ -29,13 +29,24 @@ class base_config_settings(osv.TransientModel):
|
|||
'auth_signup_template_user_id': fields.many2one('res.users', 'Template user for new users created through signup'),
|
||||
}
|
||||
|
||||
#todo: @al, @chs: what is this method for ?
|
||||
def get_default_signup(self, cr, uid, fields, context=None):
|
||||
icp = self.pool.get('ir.config_parameter')
|
||||
return {
|
||||
'auth_signup_template_user_id': icp.get_param(cr, uid, 'auth.signup_template_user_id', 0) or False
|
||||
}
|
||||
|
||||
#todo: @al, @chs: what is this method for ?
|
||||
def set_signup(self, cr, uid, ids, context=None):
|
||||
config = self.browse(cr, uid, ids[0], context=context)
|
||||
icp = self.pool.get('ir.config_parameter')
|
||||
icp.set_param(cr, uid, 'auth.signup_template_user_id', config.auth_signup_template_user_id.id)
|
||||
|
||||
def _get_default_template_user(self, cr, uid, context=None):
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
data_id = data_obj._get_id(cr, uid, 'portal', 'default_template_user')
|
||||
return data_obj.browse(cr, uid, data_id).res_id
|
||||
|
||||
_defaults = {
|
||||
'auth_signup_template_user_id': _get_default_template_user,
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</div>
|
||||
<div attrs="{'invisible':[('auth_signup_uninvited','=',False)]}">
|
||||
<label for="auth_signup_template_user_id"/>
|
||||
<field name="auth_signup_template_user_id" class="oe_inline"/>
|
||||
<field name="auth_signup_template_user_id" class="oe_inline" domain="['|',('active','=',0),('active','=',1)]"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
|
|
|
@ -2,6 +2,18 @@
|
|||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<!-- Create a portal template user -->
|
||||
<record id="default_template_user" model="res.users">
|
||||
<field name="name">Template Portal User</field>
|
||||
<field name="login">portal-template</field>
|
||||
<!-- No password: this template user doesn't need to log in -->
|
||||
<field name="password"></field>
|
||||
<field name="active" eval="False"/>
|
||||
<!-- Avoid auto-including this user in any default group, just like a typical portal member -->
|
||||
<field name="groups_id" eval="[(5,)]"/>
|
||||
<field name="partner_id" eval="ref('base.res_partner_1')"/>
|
||||
</record>
|
||||
|
||||
<record id="portal" model="res.portal">
|
||||
<field name="name">Portal</field>
|
||||
<field name="group_id" ref="group_portal_member"/>
|
||||
|
|
Loading…
Reference in New Issue