From 7386158c484874d7c8ba9ed97077cf43c0e243c9 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 16 Jul 2019 20:35:54 +0200 Subject: [PATCH] [MIG+FIX] acocunt_payment_order: Don't add field definition for existing related non stored ones `state` and `partner_id` fields exist on v8, but they are not stored. We shouldn't add them as full fields, or we will have an ir_model_fields_name_model_uniq constraint error. Instead, we should add them as SQL columns. Fixes #616 --- .../migrations/9.0.1.0.0/pre-migration.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/account_payment_order/migrations/9.0.1.0.0/pre-migration.py b/account_payment_order/migrations/9.0.1.0.0/pre-migration.py index c6f38f802..e93c18f40 100644 --- a/account_payment_order/migrations/9.0.1.0.0/pre-migration.py +++ b/account_payment_order/migrations/9.0.1.0.0/pre-migration.py @@ -157,17 +157,19 @@ def populate_computed_fields(env): faster. """ cr = env.cr + openupgrade.logged_query( + cr, "ALTER TABLE bank_payment_line ADD partner_id int4", + ) + openupgrade.logged_query( + cr, "ALTER TABLE bank_payment_line ADD state varchar", + ) openupgrade.add_fields(env, [ ('company_currency_id', 'account.payment.order', 'account_payment_order', 'many2one', False, 'account_payment_order'), ('payment_type', 'account.payment.line', 'account_payment_line', 'selection', False, 'account_payment_order'), - ('partner_id', 'bank.payment.line', 'bank_payment_line', - 'many2one', False, 'account_payment_order'), ('payment_type', 'bank.payment.line', 'bank_payment_line', 'selection', False, 'account_payment_order'), - ('state', 'bank.payment.line', 'bank_payment_line', - 'selection', False, 'account_payment_order'), ('amount_company_currency', 'bank.payment.line', 'bank_payment_line', 'monetary', False, 'account_payment_order'), ])