← Back to team overview

credativ team mailing list archive

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

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/openupgrade-server/6.1-fix_client_action_table into lp:openupgrade-server/6.1.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-server/6.1-fix_client_action_table/+merge/203112

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;
-- 
https://code.launchpad.net/~therp-nl/openupgrade-server/6.1-fix_client_action_table/+merge/203112
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-server/6.1-fix_client_action_table into lp:openupgrade-server/6.1.
=== modified file 'openerp/addons/base/migrations/6.1.1.3/pre-migration.py'
--- openerp/addons/base/migrations/6.1.1.3/pre-migration.py	2012-11-23 11:56:17 +0000
+++ openerp/addons/base/migrations/6.1.1.3/pre-migration.py	2014-01-24 16:34:53 +0000
@@ -29,6 +29,18 @@
     ('mail_gateway', 'mail'),
     ]
 
+def update_base_sql(cr):
+    """
+    ORM does not take care of inheritance at table level
+    """
+    cr.execute(
+        """
+        CREATE TABLE ir_act_client (
+            primary key(id)
+        )
+        INHERITS (ir_actions);
+        """)
+
 def fix_module_ids(cr):
     cr.execute(
         # courtesy of Guewen Baconnier (Camptocamp)
@@ -102,6 +114,7 @@
 
 @openupgrade.migrate()
 def migrate(cr, version):
+    update_base_sql(cr)
     migrate_timestamps(cr)
     add_serialization_field(cr)
     set_main_company(cr)


Follow ups