From c47227dca59903dfa3bd896cf7b8cb89f64f00e5 Mon Sep 17 00:00:00 2001 From: Sergio Teruel Albert Date: Mon, 12 Feb 2018 12:55:47 +0100 Subject: [PATCH] [9.0][MIG] account_payment_mode: Migration script for store related payment_type --- .../migrations/9.0.1.0.0/post-migration.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/account_payment_mode/migrations/9.0.1.0.0/post-migration.py b/account_payment_mode/migrations/9.0.1.0.0/post-migration.py index 2e22d3c0c..0e605831f 100644 --- a/account_payment_mode/migrations/9.0.1.0.0/post-migration.py +++ b/account_payment_mode/migrations/9.0.1.0.0/post-migration.py @@ -13,3 +13,12 @@ def migrate(env, version): # module and base_iban with this module if openupgrade.is_module_installed(env.cr, 'base_iban'): env['res.partner.bank'].search([])._compute_acc_type() + + # Store payment_type in store related field + openupgrade.logged_query( + env.cr, """ + UPDATE account_payment_mode apm + SET payment_type = pm.payment_type + FROM account_payment_method pm WHERE apm.payment_method_id = pm.id + WHERE payment_type IS NULL; + """)