Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/openupgrade-addons/6.0-sale_journal_picking_journals into lp:openupgrade-addons/6.0.
Requested reviews: OpenUpgrade Committers (openupgrade-committers) For more details, see: https://code.launchpad.net/~therp-nl/openupgrade-addons/6.0-sale_journal_picking_journals/+merge/134564 -- https://code.launchpad.net/~therp-nl/openupgrade-addons/6.0-sale_journal_picking_journals/+merge/134564 Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-addons/6.0-sale_journal_picking_journals into lp:openupgrade-addons/6.0.
=== added file 'sale_journal/migrations/6.0.1.0/post-migration.py' --- sale_journal/migrations/6.0.1.0/post-migration.py 1970-01-01 00:00:00 +0000 +++ sale_journal/migrations/6.0.1.0/post-migration.py 2012-11-15 20:32:27 +0000 @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This migration script copyright (C) 2012 Therp BV (<http://therp.nl>) +# +# 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/>. +# +############################################################################## + +import pooler +from openupgrade import openupgrade + +def migrate_picking_journal(cr, pool): + """ + Sale picking journals are now stock journals, + defined in the stock module + """ + stock_journal_obj = pool.get('stock.journal') + cr.execute(""" + SELECT id, name, user_id + FROM sale_journal_picking_journal + """) + journal_map = [] + for (sale_journal_id, name, user_id) in cr.fetchall(): + stock_journal_id = stock_journal_obj.create( + cr, 1, {'name': name, 'user_id': user_id}) + journal_map.append((sale_journal_id, stock_journal_id)) + for (sale_journal_id, stock_journal_id) in journal_map: + cr.execute( + "UPDATE stock_picking " + "SET stock_journal_id = %s " + "WHERE " + openupgrade.get_legacy_name('journal_id') + " = %s", + (stock_journal_id, sale_journal_id) + ) + [email protected]() +def migrate(cr, version): + pool = pooler.get_pool(cr.dbname) + migrate_picking_journal(cr, pool) === added file 'sale_journal/migrations/6.0.1.0/pre-migration.py' --- sale_journal/migrations/6.0.1.0/pre-migration.py 1970-01-01 00:00:00 +0000 +++ sale_journal/migrations/6.0.1.0/pre-migration.py 2012-11-15 20:32:27 +0000 @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This migration script copyright (C) 2012 Therp BV (<http://therp.nl>) +# +# 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/>. +# +############################################################################## + +from openupgrade import openupgrade + +column_renames = { + 'stock_picking': [ + ('journal_id', openupgrade.get_legacy_name('journal_id')), + ] + } + [email protected]() +def migrate(cr, version): + openupgrade.rename_columns(cr, column_renames) === modified file 'sale_journal/migrations/6.0.1.0/user_notes.txt' --- sale_journal/migrations/6.0.1.0/user_notes.txt 2012-06-07 14:51:52 +0000 +++ sale_journal/migrations/6.0.1.0/user_notes.txt 2012-11-15 20:32:27 +0000 @@ -1,1 +1,2 @@ -Nothing to do for module 'sale_journal' +Sale picking journals are migrated to stock journals +
-- Mailing list: https://launchpad.net/~credativ Post to : [email protected] Unsubscribe : https://launchpad.net/~credativ More help : https://help.launchpad.net/ListHelp

