Browse Source

[IMP] contract: possible error in migration if the column does not exist

pull/202/head
Jon Erik Ceberio 6 years ago
committed by Pedro M. Baeza
parent
commit
0778774eb8
  1. 5
      contract/migrations/11.0.2.0.0/pre-migration.py

5
contract/migrations/11.0.2.0.0/pre-migration.py

@ -7,6 +7,11 @@ def migrate(cr, version):
"""Rename column for specific price for keeping backwards compatibility.""" """Rename column for specific price for keeping backwards compatibility."""
if not version: if not version:
return return
cr.execute("""SELECT column_name
FROM information_schema.columns
WHERE table_name='account_analytic_invoice_line' AND
column_name='price_unit'""")
if cr.fetchone():
cr.execute( cr.execute(
"ALTER TABLE account_analytic_invoice_line " "ALTER TABLE account_analytic_invoice_line "
"RENAME price_unit TO specific_price" "RENAME price_unit TO specific_price"

Loading…
Cancel
Save