Stefan Rijnhart (Therp) has proposed merging 
lp:~openupgrade-committers/openupgrade-addons/7.0-account_analytic_plans-pedro.baeza
 into lp:openupgrade-addons.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~openupgrade-committers/openupgrade-addons/7.0-account_analytic_plans-pedro.baeza/+merge/210213

Reup of 
https://code.launchpad.net/~pedro.baeza/openupgrade-addons/7.0-account_analytic_plans/+merge/209051
-- 
https://code.launchpad.net/~openupgrade-committers/openupgrade-addons/7.0-account_analytic_plans-pedro.baeza/+merge/210213
Your team OpenUpgrade Committers is requested to review the proposed merge of 
lp:~openupgrade-committers/openupgrade-addons/7.0-account_analytic_plans-pedro.baeza
 into lp:openupgrade-addons.
=== added file 'account_analytic_plans/migrations/7.0.1.0/openupgrade_analysis_work.txt'
--- account_analytic_plans/migrations/7.0.1.0/openupgrade_analysis_work.txt	1970-01-01 00:00:00 +0000
+++ account_analytic_plans/migrations/7.0.1.0/openupgrade_analysis_work.txt	2014-03-10 14:28:39 +0000
@@ -0,0 +1,10 @@
+---Fields in module 'account_analytic_plans'---
+account_analytic_plans / account.analytic.plan.line / plan_id (many2one)            : now required
+### -> Created script for filling it for empty values
+
+---XML records in module 'account_analytic_plans'---
+DEL account.journal.column: account.journal_col11
+DEL ir.actions.act_window: account_analytic_plans.account_analytic_plan_form_action_installer
+DEL ir.actions.todo: account_analytic_plans.account_analytic_plan_installer_todo
+### -> Nothing to do
+

=== added file 'account_analytic_plans/migrations/7.0.1.0/pre-migration.py'
--- account_analytic_plans/migrations/7.0.1.0/pre-migration.py	1970-01-01 00:00:00 +0000
+++ account_analytic_plans/migrations/7.0.1.0/pre-migration.py	2014-03-10 14:28:39 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This migration script copyright (C) 2014
+#            Pedro M. Baeza ([email protected])
+#
+#    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
+
[email protected]()
+def migrate(cr, version):
+    # look for account.analytic.plan.line without plan_id
+    cr.execute("""
+        SELECT id
+        FROM account_analytic_plan_line
+        WHERE plan_id is NULL""")
+    record = cr.fetchone()
+    if record:
+        # Create support plan 
+        logged_query(cr, ("""
+            INSERT INTO account_analytic_plan ('name')
+            FROM account_analytic_plan_line
+            VALUES ('OpenUpgrade migration plan')""")
+        # Fill empty values with this new record value
+        logged_query(cr, ("""
+            UPDATE account_analytic_plan_line
+            SET plan_id = 
+                (SELECT id FROM account_analytic_plan 
+                 WHERE NAME='OpenUpgrade migration plan')
+            WHERE plan_id is NULL""")

-- 
Mailing list: https://launchpad.net/~credativ
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~credativ
More help   : https://help.launchpad.net/ListHelp

Reply via email to