Merge lp:~therp-nl/openupgrade-server/6.1-fix_client_action_table into lp:openupgrade-server/6.1

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 4006
Proposed branch: lp:~therp-nl/openupgrade-server/6.1-fix_client_action_table
Merge into: lp:openupgrade-server/6.1
Diff against target: 30 lines (+13/-0)
1 file modified
openerp/addons/base/migrations/6.1.1.3/pre-migration.py (+13/-0)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-server/6.1-fix_client_action_table
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Review via email: mp+203112@code.launchpad.net

Description of the change

The action models do something funky: they inherit at table level. A new kind of action was introduced in 6.1: the client action.

The ORM does not take care of this table inheritance, so as the OpenERP 6.1 base.sql is skipped at migration time, we need to load the relevant stanzas manually. I only noticed it when migrating a 6.0 database to 7.0, as 7.0 has some eyecatching client actions which did not work (apps interface and messaging inbox).

Previously migrated databases can be fixed easily by executing the following SQL command:

    ALTER TABLE ir_act_client INHERIT ir_actions;

To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/addons/base/migrations/6.1.1.3/pre-migration.py'
2--- openerp/addons/base/migrations/6.1.1.3/pre-migration.py 2012-11-23 11:56:17 +0000
3+++ openerp/addons/base/migrations/6.1.1.3/pre-migration.py 2014-01-24 17:27:29 +0000
4@@ -29,6 +29,18 @@
5 ('mail_gateway', 'mail'),
6 ]
7
8+def update_base_sql(cr):
9+ """
10+ ORM does not take care of inheritance at table level
11+ """
12+ cr.execute(
13+ """
14+ CREATE TABLE ir_act_client (
15+ primary key(id)
16+ )
17+ INHERITS (ir_actions);
18+ """)
19+
20 def fix_module_ids(cr):
21 cr.execute(
22 # courtesy of Guewen Baconnier (Camptocamp)
23@@ -102,6 +114,7 @@
24
25 @openupgrade.migrate()
26 def migrate(cr, version):
27+ update_base_sql(cr)
28 migrate_timestamps(cr)
29 add_serialization_field(cr)
30 set_main_company(cr)

Subscribers

People subscribed via source and target branches

to status/vote changes: