mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] contract: possible error in migration if the column does not exist
This commit is contained in:
committed by
Pedro M. Baeza
parent
de0f5a461d
commit
791285d30c
@@ -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"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user