From 820135d8acb5cdea5f26bb96a909d8d57115e54f Mon Sep 17 00:00:00 2001 From: "RavishchanraMurari (Open ERP)" Date: Thu, 9 Jun 2011 14:50:59 +0530 Subject: [PATCH 1/8] remove_address_id bzr revid: rmu@tinyerp.com-20110609092059-tf6tn6e40xk3lbnj --- openerp/addons/base/base_update.xml | 6 ++-- openerp/addons/base/res/res_user.py | 50 ++++++++++++++--------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/openerp/addons/base/base_update.xml b/openerp/addons/base/base_update.xml index 7432018fd94..220e9628c4e 100644 --- a/openerp/addons/base/base_update.xml +++ b/openerp/addons/base/base_update.xml @@ -119,7 +119,7 @@ context="{'user_preference': 0}" groups="base.group_multi_company" /> - + @@ -175,7 +175,7 @@ - + @@ -255,7 +255,7 @@ - + diff --git a/openerp/addons/base/res/res_user.py b/openerp/addons/base/res/res_user.py index 2ef2bb8d4d0..ca492c3fe96 100644 --- a/openerp/addons/base/res/res_user.py +++ b/openerp/addons/base/res/res_user.py @@ -136,7 +136,7 @@ class users(osv.osv): _('"email_from" needs to be set to send welcome mails ' 'to users')) return False - if not user.get('email'): + if not user.get('user_email'): return False return tools.email_send(email_from=None, email_to=[user['email']], @@ -175,24 +175,24 @@ class users(osv.osv): extended_users = group_obj.read(cr, uid, extended_group_id, ['users'], context=context)['users'] return dict(zip(ids, ['extended' if user in extended_users else 'simple' for user in ids])) - def _email_get(self, cr, uid, ids, name, arg, context=None): - # perform this as superuser because the current user is allowed to read users, and that includes - # the email, even without any direct read access on the res_partner_address object. - return dict([(user.id, user.address_id.email) for user in self.browse(cr, 1, ids)]) # no context to avoid potential security issues as superuser - - def _email_set(self, cr, uid, ids, name, value, arg, context=None): - if not isinstance(ids,list): - ids = [ids] - address_obj = self.pool.get('res.partner.address') - for user in self.browse(cr, uid, ids, context=context): - # perform this as superuser because the current user is allowed to write to the user, and that includes - # the email even without any direct write access on the res_partner_address object. - if user.address_id: - address_obj.write(cr, 1, user.address_id.id, {'email': value or None}) # no context to avoid potential security issues as superuser - else: - address_id = address_obj.create(cr, 1, {'name': user.name, 'email': value or None}) # no context to avoid potential security issues as superuser - self.write(cr, uid, ids, {'address_id': address_id}, context) - return True +# def _email_get(self, cr, uid, ids, name, arg, context=None): +# # perform this as superuser because the current user is allowed to read users, and that includes +# # the email, even without any direct read access on the res_partner_address object. +# return dict([(user.id, user.address_id.email) for user in self.browse(cr, 1, ids)]) # no context to avoid potential security issues as superuser +# +# def _email_set(self, cr, uid, ids, name, value, arg, context=None): +# if not isinstance(ids,list): +# ids = [ids] +# address_obj = self.pool.get('res.partner.address') +# for user in self.browse(cr, uid, ids, context=context): +# # perform this as superuser because the current user is allowed to write to the user, and that includes +# # the email even without any direct write access on the res_partner_address object. +# if user.address_id: +# address_obj.write(cr, 1, user.address_id.id, {'email': value or None}) # no context to avoid potential security issues as superuser +# else: +# address_id = address_obj.create(cr, 1, {'name': user.name, 'email': value or None}) # no context to avoid potential security issues as superuser +# self.write(cr, uid, ids, {'address_id': address_id}, context) +# return True def _set_new_password(self, cr, uid, id, name, value, args, context=None): if value is False: @@ -217,13 +217,13 @@ class users(osv.osv): fnct_inv=_set_new_password, string='Change password', help="Only specify a value if you want to change the user password. " "This user will have to logout and login again!"), - 'email': fields.char('E-mail', size=64, + 'user_email': fields.char('E-mail', size=64, help='If an email is provided, the user will be sent a message ' 'welcoming him.\n\nWarning: if "email_from" and "smtp_server"' " aren't configured, it won't be possible to email new " "users."), 'signature': fields.text('Signature', size=64), - 'address_id': fields.many2one('res.partner.address', 'Address'), + # 'address_id': fields.many2one('res.partner.address', 'Address'), 'active': fields.boolean('Active'), 'action_id': fields.many2one('ir.actions.actions', 'Home Action', help="If specified, this action will be opened at logon for this user, in addition to the standard menu."), 'menu_id': fields.many2one('ir.actions.actions', 'Menu Action', help="If specified, the action will replace the standard menu for this user."), @@ -245,7 +245,7 @@ class users(osv.osv): 'view': fields.function(_get_interface_type, method=True, type='selection', fnct_inv=_set_interface_type, selection=[('simple','Simplified'),('extended','Extended')], string='Interface', help="Choose between the simplified interface and the extended one"), - 'user_email': fields.function(_email_get, method=True, fnct_inv=_email_set, string='Email', type="char", size=240), + # 'user_email': fields.function(_email_get, method=True, fnct_inv=_email_set, string='Email', type="char", size=240), 'menu_tips': fields.boolean('Menu Tips', help="Check out this box if you want to always display tips on each menu action"), 'date': fields.datetime('Last Connection', readonly=True), } @@ -345,7 +345,7 @@ class users(osv.osv): 'company_id': _get_company, 'company_ids': _get_companies, 'groups_id': _get_group, - 'address_id': False, + # 'address_id': False, 'menu_tips':True } @@ -532,13 +532,13 @@ class config_users(osv.osv_memory): partner_id = self.pool.get('res.partner').main_partner(cr, uid) address = self.pool.get('res.partner.address').create( cr, uid, {'name': base_data['name'], - 'email': base_data['email'], + 'user_email': base_data['user_email'], 'partner_id': partner_id,}, context) user_data = dict( base_data, signature=self._generate_signature( - cr, base_data['name'], base_data['email'], context=context), + cr, base_data['name'], base_data['user_email'], context=context), address_id=address, ) new_user = self.pool.get('res.users').create( From 0187c6cf666e35b7541bfee0d6f36e8faa687baa Mon Sep 17 00:00:00 2001 From: "RavishchanraMurari (Open ERP)" Date: Thu, 16 Jun 2011 17:55:21 +0530 Subject: [PATCH 2/8] user address bzr revid: rmu@tinyerp.com-20110616122521-xymw519yxvq6amxt --- openerp/addons/base/res/res_user.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/openerp/addons/base/res/res_user.py b/openerp/addons/base/res/res_user.py index ca492c3fe96..ab2c56b42d5 100644 --- a/openerp/addons/base/res/res_user.py +++ b/openerp/addons/base/res/res_user.py @@ -513,10 +513,10 @@ class config_users(osv.osv_memory): _name = 'res.config.users' _inherit = ['res.users', 'res.config'] - def _generate_signature(self, cr, name, email, context=None): - return _('--\n%(name)s %(email)s\n') % { + def _generate_signature(self, cr, name, user_email, context=None): + return _('--\n%(name)s %(user_email)s\n') % { 'name': name or '', - 'email': email and ' <'+email+'>' or '', + 'user_mail': user_email and ' <'+user_email+'>' or '', } def create_user(self, cr, uid, new_id, context=None): @@ -529,21 +529,23 @@ class config_users(osv.osv_memory): with the user's data %-formatted into the mail body """ base_data = self.read(cr, uid, new_id, context=context) - partner_id = self.pool.get('res.partner').main_partner(cr, uid) - address = self.pool.get('res.partner.address').create( - cr, uid, {'name': base_data['name'], - 'user_email': base_data['user_email'], - 'partner_id': partner_id,}, - context) + #partner_id = self.pool.get('res.partner').main_partner(cr, uid) + #address = self.pool.get('res.partner.address').create( + + #cr, uid, {'name': base_data['name'], + #'email': base_data['email'], + #'partner_id': partner_id,},context) + user_data = dict( base_data, signature=self._generate_signature( - cr, base_data['name'], base_data['user_email'], context=context), - address_id=address, + cr, base_data['name'], base_data['user_email'], context=context) + #address_id=address, ) new_user = self.pool.get('res.users').create( cr, uid, user_data, context) self.send_welcome_email(cr, uid, new_user, context=context) + def execute(self, cr, uid, ids, context=None): 'Do nothing on execution, just launch the next action/todo' pass From 067b91a961698d57ab606afb9766fe6ac0e774c1 Mon Sep 17 00:00:00 2001 From: "RavishchanraMurari (Open ERP)" Date: Fri, 17 Jun 2011 13:29:54 +0530 Subject: [PATCH 3/8] user address bzr revid: rmu@tinyerp.com-20110617075954-tis7gi2fezxjyjd9 --- openerp/addons/base/res/res_user.py | 44 +++++++---------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/openerp/addons/base/res/res_user.py b/openerp/addons/base/res/res_user.py index ab2c56b42d5..42e7307aca0 100644 --- a/openerp/addons/base/res/res_user.py +++ b/openerp/addons/base/res/res_user.py @@ -113,6 +113,7 @@ class users(osv.osv): is to return config_users.WELCOME_MAIL_SUBJECT """ return self.WELCOME_MAIL_SUBJECT + def get_welcome_mail_body(self, cr, uid, context=None): """ Returns the subject of the mail new users receive (when created via the res.config.users wizard), default implementation @@ -175,24 +176,7 @@ class users(osv.osv): extended_users = group_obj.read(cr, uid, extended_group_id, ['users'], context=context)['users'] return dict(zip(ids, ['extended' if user in extended_users else 'simple' for user in ids])) -# def _email_get(self, cr, uid, ids, name, arg, context=None): -# # perform this as superuser because the current user is allowed to read users, and that includes -# # the email, even without any direct read access on the res_partner_address object. -# return dict([(user.id, user.address_id.email) for user in self.browse(cr, 1, ids)]) # no context to avoid potential security issues as superuser -# -# def _email_set(self, cr, uid, ids, name, value, arg, context=None): -# if not isinstance(ids,list): -# ids = [ids] -# address_obj = self.pool.get('res.partner.address') -# for user in self.browse(cr, uid, ids, context=context): -# # perform this as superuser because the current user is allowed to write to the user, and that includes -# # the email even without any direct write access on the res_partner_address object. -# if user.address_id: -# address_obj.write(cr, 1, user.address_id.id, {'email': value or None}) # no context to avoid potential security issues as superuser -# else: -# address_id = address_obj.create(cr, 1, {'name': user.name, 'email': value or None}) # no context to avoid potential security issues as superuser -# self.write(cr, uid, ids, {'address_id': address_id}, context) -# return True + def _set_new_password(self, cr, uid, id, name, value, args, context=None): if value is False: @@ -217,14 +201,15 @@ class users(osv.osv): fnct_inv=_set_new_password, string='Change password', help="Only specify a value if you want to change the user password. " "This user will have to logout and login again!"), + 'user_email': fields.char('E-mail', size=64, help='If an email is provided, the user will be sent a message ' 'welcoming him.\n\nWarning: if "email_from" and "smtp_server"' " aren't configured, it won't be possible to email new " "users."), + 'signature': fields.text('Signature', size=64), - # 'address_id': fields.many2one('res.partner.address', 'Address'), - 'active': fields.boolean('Active'), + 'active': fields.boolean('Active'), 'action_id': fields.many2one('ir.actions.actions', 'Home Action', help="If specified, this action will be opened at logon for this user, in addition to the standard menu."), 'menu_id': fields.many2one('ir.actions.actions', 'Menu Action', help="If specified, the action will replace the standard menu for this user."), 'groups_id': fields.many2many('res.groups', 'res_groups_users_rel', 'uid', 'gid', 'Groups'), @@ -245,8 +230,7 @@ class users(osv.osv): 'view': fields.function(_get_interface_type, method=True, type='selection', fnct_inv=_set_interface_type, selection=[('simple','Simplified'),('extended','Extended')], string='Interface', help="Choose between the simplified interface and the extended one"), - # 'user_email': fields.function(_email_get, method=True, fnct_inv=_email_set, string='Email', type="char", size=240), - 'menu_tips': fields.boolean('Menu Tips', help="Check out this box if you want to always display tips on each menu action"), + 'menu_tips': fields.boolean('Menu Tips', help="Check out this box if you want to always display tips on each menu action"), 'date': fields.datetime('Last Connection', readonly=True), } @@ -345,7 +329,6 @@ class users(osv.osv): 'company_id': _get_company, 'company_ids': _get_companies, 'groups_id': _get_group, - # 'address_id': False, 'menu_tips':True } @@ -514,9 +497,9 @@ class config_users(osv.osv_memory): _inherit = ['res.users', 'res.config'] def _generate_signature(self, cr, name, user_email, context=None): - return _('--\n%(name)s %(user_email)s\n') % { + return _('--\n%(name)s %(email)s\n') % { 'name': name or '', - 'user_mail': user_email and ' <'+user_email+'>' or '', + 'email': email and ' <'+email+'>' or '', } def create_user(self, cr, uid, new_id, context=None): @@ -529,18 +512,11 @@ class config_users(osv.osv_memory): with the user's data %-formatted into the mail body """ base_data = self.read(cr, uid, new_id, context=context) - #partner_id = self.pool.get('res.partner').main_partner(cr, uid) - #address = self.pool.get('res.partner.address').create( - - #cr, uid, {'name': base_data['name'], - #'email': base_data['email'], - #'partner_id': partner_id,},context) - + user_data = dict( base_data, signature=self._generate_signature( - cr, base_data['name'], base_data['user_email'], context=context) - #address_id=address, + cr, base_data['name'], base_data['email'], context=context) ) new_user = self.pool.get('res.users').create( cr, uid, user_data, context) From e8b98c450b8ad55cb00b08cb3c4c37f01ec6faa2 Mon Sep 17 00:00:00 2001 From: "RavishchanraMurari (Open ERP)" Date: Tue, 21 Jun 2011 16:07:29 +0530 Subject: [PATCH 4/8] user address bzr revid: rmu@tinyerp.com-20110621103729-6xbkj71rdkfp9q7y --- openerp/addons/base/res/res_user.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/openerp/addons/base/res/res_user.py b/openerp/addons/base/res/res_user.py index 42e7307aca0..c91be997172 100644 --- a/openerp/addons/base/res/res_user.py +++ b/openerp/addons/base/res/res_user.py @@ -38,7 +38,7 @@ class groups(osv.osv): 'name': fields.char('Group Name', size=64, required=True), 'model_access': fields.one2many('ir.model.access', 'group_id', 'Access Controls'), 'rule_groups': fields.many2many('ir.rule', 'rule_group_rel', - 'group_id', 'rule_group_id', 'Rules', domain=[('global', '=', False)]), + 'group_id', 'rule_group_id', 'Rules', domain=[('global', '=', False)]), 'menu_access': fields.many2many('ir.ui.menu', 'ir_ui_menu_group_rel', 'gid', 'menu_id', 'Access Menu'), 'comment' : fields.text('Comment',size=250), } @@ -113,7 +113,6 @@ class users(osv.osv): is to return config_users.WELCOME_MAIL_SUBJECT """ return self.WELCOME_MAIL_SUBJECT - def get_welcome_mail_body(self, cr, uid, context=None): """ Returns the subject of the mail new users receive (when created via the res.config.users wizard), default implementation @@ -201,13 +200,11 @@ class users(osv.osv): fnct_inv=_set_new_password, string='Change password', help="Only specify a value if you want to change the user password. " "This user will have to logout and login again!"), - 'user_email': fields.char('E-mail', size=64, help='If an email is provided, the user will be sent a message ' 'welcoming him.\n\nWarning: if "email_from" and "smtp_server"' " aren't configured, it won't be possible to email new " "users."), - 'signature': fields.text('Signature', size=64), 'active': fields.boolean('Active'), 'action_id': fields.many2one('ir.actions.actions', 'Home Action', help="If specified, this action will be opened at logon for this user, in addition to the standard menu."), @@ -496,7 +493,7 @@ class config_users(osv.osv_memory): _name = 'res.config.users' _inherit = ['res.users', 'res.config'] - def _generate_signature(self, cr, name, user_email, context=None): + def _generate_signature(self, cr, name, email, context=None): return _('--\n%(name)s %(email)s\n') % { 'name': name or '', 'email': email and ' <'+email+'>' or '', @@ -512,7 +509,6 @@ class config_users(osv.osv_memory): with the user's data %-formatted into the mail body """ base_data = self.read(cr, uid, new_id, context=context) - user_data = dict( base_data, signature=self._generate_signature( From fa645f7f0bc9195886dc15e195721557c631b82b Mon Sep 17 00:00:00 2001 From: "RavishchanraMurari (Open ERP)" Date: Tue, 21 Jun 2011 16:24:36 +0530 Subject: [PATCH 5/8] user address bzr revid: rmu@tinyerp.com-20110621105436-i4us13fk76ntx7gn --- openerp/addons/base/res/res_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/res/res_user.py b/openerp/addons/base/res/res_user.py index c91be997172..ea1f6b2142e 100644 --- a/openerp/addons/base/res/res_user.py +++ b/openerp/addons/base/res/res_user.py @@ -136,7 +136,7 @@ class users(osv.osv): _('"email_from" needs to be set to send welcome mails ' 'to users')) return False - if not user.get('user_email'): + if not user.get('email'): return False return tools.email_send(email_from=None, email_to=[user['email']], From ae6007b9cf9fe0e74dde7f0e29e33d868c2ab1e6 Mon Sep 17 00:00:00 2001 From: "RavishchanraMurari (Open ERP)" Date: Mon, 25 Jul 2011 15:26:16 +0530 Subject: [PATCH 6/8] update_address_id_usr_email bzr revid: rmu@tinyerp.com-20110725095616-5p2lkyomcxyo4t0n --- openerp/addons/base/base_update.xml | 2 -- openerp/addons/base/res/res_user.py | 27 +++------------------------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/openerp/addons/base/base_update.xml b/openerp/addons/base/base_update.xml index 1820c8df9f3..ed67b2f16ee 100644 --- a/openerp/addons/base/base_update.xml +++ b/openerp/addons/base/base_update.xml @@ -119,7 +119,6 @@ context="{'user_preference': 0}" groups="base.group_multi_company" /> - @@ -175,7 +174,6 @@ - diff --git a/openerp/addons/base/res/res_user.py b/openerp/addons/base/res/res_user.py index f3c0f635d14..edeb334d2fb 100644 --- a/openerp/addons/base/res/res_user.py +++ b/openerp/addons/base/res/res_user.py @@ -175,25 +175,6 @@ class users(osv.osv): extended_users = group_obj.read(cr, uid, extended_group_id, ['users'], context=context)['users'] return dict(zip(ids, ['extended' if user in extended_users else 'simple' for user in ids])) - def _email_get(self, cr, uid, ids, name, arg, context=None): - # perform this as superuser because the current user is allowed to read users, and that includes - # the email, even without any direct read access on the res_partner_address object. - return dict([(user.id, user.address_id.email) for user in self.browse(cr, 1, ids)]) # no context to avoid potential security issues as superuser - - def _email_set(self, cr, uid, ids, name, value, arg, context=None): - if not isinstance(ids,list): - ids = [ids] - address_obj = self.pool.get('res.partner.address') - for user in self.browse(cr, uid, ids, context=context): - # perform this as superuser because the current user is allowed to write to the user, and that includes - # the email even without any direct write access on the res_partner_address object. - if user.address_id: - address_obj.write(cr, 1, user.address_id.id, {'email': value or None}) # no context to avoid potential security issues as superuser - else: - address_id = address_obj.create(cr, 1, {'name': user.name, 'email': value or None}) # no context to avoid potential security issues as superuser - self.write(cr, uid, ids, {'address_id': address_id}, context) - return True - def _set_new_password(self, cr, uid, id, name, value, args, context=None): if value is False: # Do not update the password if no value is provided, ignore silently. @@ -220,13 +201,12 @@ class users(osv.osv): fnct_inv=_set_new_password, string='Change password', help="Only specify a value if you want to change the user password. " "This user will have to logout and login again!"), - 'email': fields.char('E-mail', size=64, + 'user_email': fields.char('E-mail', size=64, help='If an email is provided, the user will be sent a message ' 'welcoming him.\n\nWarning: if "email_from" and "smtp_server"' " aren't configured, it won't be possible to email new " "users."), 'signature': fields.text('Signature', size=64), - 'address_id': fields.many2one('res.partner.address', 'Address'), 'active': fields.boolean('Active'), 'action_id': fields.many2one('ir.actions.actions', 'Home Action', help="If specified, this action will be opened at logon for this user, in addition to the standard menu."), 'menu_id': fields.many2one('ir.actions.actions', 'Menu Action', help="If specified, the action will replace the standard menu for this user."), @@ -247,7 +227,7 @@ class users(osv.osv): 'view': fields.function(_get_interface_type, method=True, type='selection', fnct_inv=_set_interface_type, selection=[('simple','Simplified'),('extended','Extended')], string='Interface', help="OpenERP offers a simplified and an extended user interface. If you use OpenERP for the first time we strongly advise you to select the simplified interface, which has less features but is easier to use. You can switch to the other interface from the User/Preferences menu at any time."), - 'user_email': fields.function(_email_get, method=True, fnct_inv=_email_set, string='Email', type="char", size=240), + 'menu_tips': fields.boolean('Menu Tips', help="Check out this box if you want to always display tips on each menu action"), 'date': fields.datetime('Last Connection', readonly=True), } @@ -346,7 +326,6 @@ class users(osv.osv): 'company_id': _get_company, 'company_ids': _get_companies, 'groups_id': _get_group, - 'address_id': False, 'menu_tips':True } @@ -414,7 +393,7 @@ class users(osv.osv): copy_pattern = _("%s (copy)") copydef = dict(login=(copy_pattern % user2copy['login']), name=(copy_pattern % user2copy['name']), - address_id=False, # avoid sharing the address of the copied user! + # avoid sharing the address of the copied user! ) copydef.update(default) return super(users, self).copy(cr, uid, id, copydef, context) From 978f6a9ab619b2fede87fef55d39d17140bef4ac Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 3 Aug 2011 14:08:14 +0200 Subject: [PATCH 7/8] add migration script: copy user emails from their address bzr revid: rco@openerp.com-20110803120814-8entoezaysjgv317 --- openerp/addons/base/__openerp__.py | 2 +- .../base/migrations/1.4/post-user-address.py | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 openerp/addons/base/migrations/1.4/post-user-address.py diff --git a/openerp/addons/base/__openerp__.py b/openerp/addons/base/__openerp__.py index c757702d52f..ee0063dc0d9 100644 --- a/openerp/addons/base/__openerp__.py +++ b/openerp/addons/base/__openerp__.py @@ -23,7 +23,7 @@ { 'name': 'Base', - 'version': '1.3', + 'version': '1.4', 'category': 'Generic Modules/Base', 'complexity': "easy", 'description': """The kernel of OpenERP, needed for all installation.""", diff --git a/openerp/addons/base/migrations/1.4/post-user-address.py b/openerp/addons/base/migrations/1.4/post-user-address.py new file mode 100644 index 00000000000..bb6e2fa487e --- /dev/null +++ b/openerp/addons/base/migrations/1.4/post-user-address.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 OpenERP s.a. (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +def migrate(cr, version): + "copy emails from user.address_id.email to user.user_email" + cr.execute(""" + UPDATE res_users + SET user_email = res_partner_address.email + FROM res_partner_address + WHERE res_users.address_id = res_partner_address.id""") + From 71b82691b6820d13cf34e130244372ec3784fcbe Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 3 Aug 2011 14:13:17 +0200 Subject: [PATCH 8/8] [IMP] user-address migration: drop column address_id bzr revid: rco@openerp.com-20110803121317-qy3k5q4rjyp89vu9 --- openerp/addons/base/migrations/1.4/post-user-address.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openerp/addons/base/migrations/1.4/post-user-address.py b/openerp/addons/base/migrations/1.4/post-user-address.py index bb6e2fa487e..ca653d7537c 100644 --- a/openerp/addons/base/migrations/1.4/post-user-address.py +++ b/openerp/addons/base/migrations/1.4/post-user-address.py @@ -26,4 +26,6 @@ def migrate(cr, version): SET user_email = res_partner_address.email FROM res_partner_address WHERE res_users.address_id = res_partner_address.id""") + cr.execute(""" + ALTER TABLE res_users DROP COLUMN address_id""")