[IMP] portal: make the wizard modify contact emails (because related field does not work)
bzr revid: rco@openerp.com-20120918090335-mvmy2n8l3misnxow
This commit is contained in:
@@ -123,10 +123,18 @@ class wizard_user(osv.osv_memory):
|
||||
_columns = {
|
||||
'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True),
|
||||
'partner_id': fields.many2one('res.partner', string='Contact', required=True, readonly=True),
|
||||
'email': fields.related('partner_id', 'email', type='char', string='Email'),
|
||||
'email': fields.char(size=240, string='Email'),
|
||||
'in_portal': fields.boolean('In Portal'),
|
||||
}
|
||||
|
||||
def create(self, cr, uid, values, context=None):
|
||||
""" overridden to update the partner's email (if necessary) """
|
||||
id = super(wizard_user, self).create(cr, uid, values, context)
|
||||
wuser = self.browse(cr, uid, id, context)
|
||||
if wuser.partner_id.email != wuser.email:
|
||||
wuser.partner_id.write({'email': wuser.email})
|
||||
return id
|
||||
|
||||
def action_apply(self, cr, uid, ids, context=None):
|
||||
res_users = self.pool.get('res.users')
|
||||
for wizard_user in self.browse(cr, SUPERUSER_ID, ids, context):
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
<group>
|
||||
<field name="portal_id" widget="selection" on_change="onchange_portal_id(portal_id, context)"/>
|
||||
</group>
|
||||
<label string="Fill in check boxes below to determine which contacts should belong to the portal."/>
|
||||
<div>
|
||||
Select which contacts should belong to the portal in the list below.
|
||||
The email address of each selected contact must be valid and unique.
|
||||
If necessary, you can fix any contact's email address directly in the list.
|
||||
</div>
|
||||
<field name="user_ids"/>
|
||||
<field name="message" placeholder="This text will be included in the welcome email sent to users."/>
|
||||
<footer>
|
||||
|
||||
Reference in New Issue
Block a user