← Back to team overview

credativ team mailing list archive

[Merge] lp:~therp-nl/openupgrade-server/7.0-improve_model_renames into lp:openupgrade-server

 

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

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-improve_model_renames/+merge/168614
-- 
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-improve_model_renames/+merge/168614
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-server/7.0-improve_model_renames into lp:openupgrade-server.
=== modified file 'openerp/addons/base/migrations/7.0.1.3/pre-migration.py'
--- openerp/addons/base/migrations/7.0.1.3/pre-migration.py	2013-02-23 09:21:24 +0000
+++ openerp/addons/base/migrations/7.0.1.3/pre-migration.py	2013-06-11 08:16:30 +0000
@@ -43,6 +43,9 @@
 }
 
 xmlid_renames = []
+model_renames = [
+    ('ir.actions.url', 'ir.actions.act_url'),
+    ]
 
 def migrate_ir_attachment(cr):
     # Data is now stored in db_datas column and datas is a function field
@@ -162,5 +165,6 @@
     openupgrade.drop_columns(cr, [('ir_actions_todo', 'action_id')])
     openupgrade.rename_columns(cr, column_renames)
     openupgrade.rename_xmlids(cr, xmlid_renames)
+    openupgrade.rename_models(cr, model_renames)
     migrate_ir_attachment(cr)
     create_users_partner(cr)

=== modified file 'openerp/openupgrade/openupgrade.py'
--- openerp/openupgrade/openupgrade.py	2013-05-03 12:20:05 +0000
+++ openerp/openupgrade/openupgrade.py	2013-06-11 08:16:30 +0000
@@ -143,6 +143,8 @@
     for (old, new) in model_spec:
         logger.info("model %s: renaming to %s",
                     old, new)
+        cr.execute('UPDATE ir_model SET model = %s '
+                   'WHERE model = %s', (new, old,))
         cr.execute('UPDATE ir_model_fields SET relation = %s '
                    'WHERE relation = %s', (new, old,))
     # TODO: signal where the model occurs in references to ir_model


Follow ups