diff --git a/account_banking_payment_export/migrations/8.0.0.1.166/pre-migrate.py b/account_banking_payment_export/migrations/8.0.0.1.166/pre-migrate.py index 97f37ffd3..870747844 100644 --- a/account_banking_payment_export/migrations/8.0.0.1.166/pre-migrate.py +++ b/account_banking_payment_export/migrations/8.0.0.1.166/pre-migrate.py @@ -20,7 +20,14 @@ def migrate(cr, version): - cr.execute('alter table payment_order add column total numeric') + cr.execute( + 'SELECT count(attname) FROM pg_attribute ' + 'WHERE attrelid = ' + '( SELECT oid FROM pg_class WHERE relname = %s ) ' + 'AND attname = %s', + ('payment_order', 'total')) + if cr.fetchone()[0] == 0: + cr.execute('alter table payment_order add column total numeric') cr.execute( 'update payment_order ' 'set total=totals.total '