From 75b55a0df7f0d8dcb805cc40afd3a2b2f798b4b5 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 18 Sep 2012 11:03:35 +0200 Subject: [PATCH] [IMP] portal: make the wizard modify contact emails (because related field does not work) bzr revid: rco@openerp.com-20120918090335-mvmy2n8l3misnxow --- addons/portal/wizard/portal_wizard.py | 10 +++++++++- addons/portal/wizard/portal_wizard_view.xml | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py index 8ad956510eb..aa6a9cf96c6 100644 --- a/addons/portal/wizard/portal_wizard.py +++ b/addons/portal/wizard/portal_wizard.py @@ -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): diff --git a/addons/portal/wizard/portal_wizard_view.xml b/addons/portal/wizard/portal_wizard_view.xml index 6c31a3da371..b2686b34c27 100644 --- a/addons/portal/wizard/portal_wizard_view.xml +++ b/addons/portal/wizard/portal_wizard_view.xml @@ -19,7 +19,11 @@ -