mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] account_banking_payment_export: Check if column exists before creating it
This commit is contained in:
@@ -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 '
|
||||
|
||||
Reference in New Issue
Block a user