From 8f27c93351cdd363322a39a257061138af2abe26 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 14 Apr 2018 13:03:16 +0200 Subject: [PATCH] [FIX] account_payment_mode: Don't store acc_type of res.partner.bank (#467) --- account_payment_mode/__manifest__.py | 2 +- .../migrations/10.0.1.0.2/pre-migration.py | 10 ++++++++++ account_payment_mode/models/res_partner_bank.py | 10 +++++++--- account_payment_mode/views/res_partner_bank.xml | 14 -------------- 4 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 account_payment_mode/migrations/10.0.1.0.2/pre-migration.py diff --git a/account_payment_mode/__manifest__.py b/account_payment_mode/__manifest__.py index 2798775c0..b37af6420 100644 --- a/account_payment_mode/__manifest__.py +++ b/account_payment_mode/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Account Payment Mode', - 'version': '10.0.1.0.1', + 'version': '10.0.1.0.2', 'license': 'AGPL-3', 'author': "Akretion,Odoo Community Association (OCA)", 'website': 'https://github.com/OCA/bank-payment', diff --git a/account_payment_mode/migrations/10.0.1.0.2/pre-migration.py b/account_payment_mode/migrations/10.0.1.0.2/pre-migration.py new file mode 100644 index 000000000..873976730 --- /dev/null +++ b/account_payment_mode/migrations/10.0.1.0.2/pre-migration.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +def migrate(cr, version): + if not version: + return + + cr.execute('ALTER TABLE res_partner_bank DROP COLUMN acc_type') diff --git a/account_payment_mode/models/res_partner_bank.py b/account_payment_mode/models/res_partner_bank.py index fa4ff05f8..fe0688cd0 100644 --- a/account_payment_mode/models/res_partner_bank.py +++ b/account_payment_mode/models/res_partner_bank.py @@ -8,6 +8,10 @@ from odoo import models, fields class ResPartnerBank(models.Model): _inherit = 'res.partner.bank' - # I also have to change the label of the field in the view - # I store the field, so that we can do groupby and search on it - acc_type = fields.Char(string='Bank Account Type', store=True) + # I change the label of the field in the view. + # I would also like to store the field to do easy groupby and search, + # but it's not possible because the compute method is inherited + # in base_iban (and maybe in other modules) and, when the field is + # initially computed+stored, it doesn't take into account the + # inherits of the method that compute this field + acc_type = fields.Char(string='Bank Account Type') diff --git a/account_payment_mode/views/res_partner_bank.xml b/account_payment_mode/views/res_partner_bank.xml index 6ccd79778..bd4443d56 100644 --- a/account_payment_mode/views/res_partner_bank.xml +++ b/account_payment_mode/views/res_partner_bank.xml @@ -25,19 +25,5 @@ detect wrong IBANs --> - - account_payment_mode.res_partner_bank_search - res.partner.bank - - - - - - - - - -