From 53182211d8ef2f6cfb0d1c87988e78876d5f575e Mon Sep 17 00:00:00 2001 From: dufresnedavid Date: Mon, 4 May 2015 11:49:56 -0400 Subject: [PATCH] Fix migration script --- base_location/migrations/7.0.1.0/post-migration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base_location/migrations/7.0.1.0/post-migration.py b/base_location/migrations/7.0.1.0/post-migration.py index 515e72bf8..01aad2a38 100644 --- a/base_location/migrations/7.0.1.0/post-migration.py +++ b/base_location/migrations/7.0.1.0/post-migration.py @@ -45,8 +45,8 @@ def remove_sql_constraint_duplicates(cr, model, constraint_attrs): form the uniq key """ pool = pooler.get_pool(cr.dbname) - model_table = model.replace('.', '_') model_pool = pool[model] + model_table = model_pool._table # Get all fields with the given model as many2one relation field_pool = pool['ir.model.fields'] @@ -58,7 +58,7 @@ def remove_sql_constraint_duplicates(cr, model, constraint_attrs): # This is trivial for many2one relations tables_to_lookup = [ ( - field.model_id.model.replace('.', '_'), + pool[field.model_id.model]._table, field.name, 'many2one' ) for field in field_pool.browse(cr, SUPERUSER_ID, field_m2o_ids) ] @@ -75,7 +75,7 @@ def remove_sql_constraint_duplicates(cr, model, constraint_attrs): for field in fields_m2m: - other_model_table = field.model_id.model.replace('.', '_') + other_model_table = pool[field.model_id.model]._table # Get all primary key constraints for the given table query = "SELECT " \