Skip to content

Commit

Permalink
[FIX] Table renamed crm_lead_lost_reason using rename_tables (#1525)
Browse files Browse the repository at this point in the history
This fixes renaming crm_lead_lost_reason to crm_lost_reason using
openupgrade's rename_tables so that sequences are renamed as well.
Since the table is created in an OCA module, first it is checked that
the table exists
  • Loading branch information
Dimitrios Tanis authored and pedrobaeza committed Sep 26, 2018
1 parent 9593420 commit adad3b0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions addons/crm/migrations/9.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,5 @@ def migrate(env, version):
[('4', '3')], table='crm_lead',
)
cr.execute("update crm_lead set type='opportunity' where type is null")
# Needed for crm_lead_lost_reason migration
cr.execute("ALTER TABLE IF EXISTS crm_lead_lost_reason "
"RENAME TO crm_lost_reason")
if openupgrade.table_exists(cr, 'crm_lead_lost_reason'):
openupgrade.rename_tables(cr, [('crm_lead_lost_reason', 'crm_lost_reason')])

0 comments on commit adad3b0

Please sign in to comment.