Browse Source

Merge pull request #171 from Digital5-Odoo/11.0

[IMP] contract: possible error in migration if the column does not exist
pull/169/head
Pedro M. Baeza 6 years ago
committed by GitHub
parent
commit
196eb44376
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      contract/migrations/11.0.2.0.0/pre-migration.py

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

@ -7,7 +7,12 @@ def migrate(cr, version):
"""Rename column for specific price for keeping backwards compatibility."""
if not version:
return
cr.execute(
"ALTER TABLE account_analytic_invoice_line "
"RENAME price_unit TO specific_price"
)
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(
"ALTER TABLE account_analytic_invoice_line "
"RENAME price_unit TO specific_price"
)
Loading…
Cancel
Save