[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
This commit is contained in:
Pedro M. Baeza
2019-07-16 20:35:54 +02:00
parent 1ffa4034c4
commit 7386158c48

View File

@@ -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'),
])