Merge lp:~therp-nl/openupgrade-addons/6.1-stock_migrate_workitems_in_act_cancel_inv into lp:openupgrade-addons/6.1

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 6608
Proposed branch: lp:~therp-nl/openupgrade-addons/6.1-stock_migrate_workitems_in_act_cancel_inv
Merge into: lp:openupgrade-addons/6.1
Diff against target: 55 lines (+45/-1)
2 files modified
stock/migrations/6.1.1.1/pre-migration.py (+43/-0)
stock/migrations/6.1.1.1/user_notes.txt (+2/-1)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-addons/6.1-stock_migrate_workitems_in_act_cancel_inv
Reviewer Review Type Date Requested Status
OpenUpgrade Committers Pending
Review via email: mp+130100@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'stock/migrations/6.1.1.1/pre-migration.py'
2--- stock/migrations/6.1.1.1/pre-migration.py 1970-01-01 00:00:00 +0000
3+++ stock/migrations/6.1.1.1/pre-migration.py 2012-10-17 12:13:24 +0000
4@@ -0,0 +1,43 @@
5+# -*- coding: utf-8 -*-
6+##############################################################################
7+#
8+# OpenERP, Open Source Management Solution
9+# This module copyright (C) 2012 Therp BV (<http://therp.nl>).
10+#
11+# This program is free software: you can redistribute it and/or modify
12+# it under the terms of the GNU Affero General Public License as
13+# published by the Free Software Foundation, either version 3 of the
14+# License, or (at your option) any later version.
15+#
16+# This program is distributed in the hope that it will be useful,
17+# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+# GNU Affero General Public License for more details.
20+#
21+# You should have received a copy of the GNU Affero General Public License
22+# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+#
24+##############################################################################
25+
26+from openerp.openupgrade import openupgrade
27+
28+def update_wkf_items(cr):
29+ """
30+ Replace references to act_cancel_inv with
31+ references to act_cancel in workflow workitems
32+ """
33+ openupgrade.logged_query(cr, """
34+ UPDATE wkf_workitem
35+ SET act_id = (
36+ SELECT res_id FROM ir_model_data
37+ WHERE module = 'stock'
38+ AND name = 'act_cancel')
39+ WHERE act_id = (
40+ SELECT res_id FROM ir_model_data
41+ WHERE module = 'stock'
42+ AND name = 'act_cancel_inv')
43+ """)
44+
45+@openupgrade.migrate()
46+def migrate(cr, version):
47+ update_wkf_items(cr)
48
49=== modified file 'stock/migrations/6.1.1.1/user_notes.txt'
50--- stock/migrations/6.1.1.1/user_notes.txt 2012-06-06 09:24:16 +0000
51+++ stock/migrations/6.1.1.1/user_notes.txt 2012-10-17 12:13:24 +0000
52@@ -1,1 +1,2 @@
53-Nothing to do for module 'stock'
54+This migration script updates existing workflow items that have an obsolete cancelled state.
55+

Subscribers

People subscribed via source and target branches