From 978f6a9ab619b2fede87fef55d39d17140bef4ac Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 3 Aug 2011 14:08:14 +0200 Subject: [PATCH] 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""") +