add migration script: copy user emails from their address

bzr revid: rco@openerp.com-20110803120814-8entoezaysjgv317
This commit is contained in:
Raphael Collet
2011-08-03 14:08:14 +02:00
parent ae6007b9cf
commit 978f6a9ab6
2 changed files with 30 additions and 1 deletions
+1 -1
View File
@@ -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.""",
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP s.a. (<http://openerp.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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""")