From aad52940a970741720fb744e83f8cca9ab213592 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 14 Jun 2016 22:25:23 +0200 Subject: [PATCH] Move field bank_account_required from module account_payment_partner to account_payment_mode Make the mandate a required field on payment line when the payment method has mandate_required=True Make the bank account a required field on payment line when the payment method has bank_account_required=True Minor code cleanup PEP8 --- account_payment_partner/__openerp__.py | 1 - account_payment_partner/models/__init__.py | 1 - .../models/account_invoice.py | 9 ++++----- .../models/account_payment_method.py | 14 ------------- .../views/account_payment_method.xml | 20 ------------------- 5 files changed, 4 insertions(+), 41 deletions(-) delete mode 100644 account_payment_partner/models/account_payment_method.py delete mode 100644 account_payment_partner/views/account_payment_method.xml diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index 844f5a553..8c1068021 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -16,7 +16,6 @@ 'depends': ['account_payment_mode'], 'data': [ 'views/res_partner_view.xml', - 'views/account_payment_method.xml', 'views/account_invoice_view.xml', 'views/account_move_line.xml', 'views/report_invoice.xml', diff --git a/account_payment_partner/models/__init__.py b/account_payment_partner/models/__init__.py index caea9e62c..152bb919c 100644 --- a/account_payment_partner/models/__init__.py +++ b/account_payment_partner/models/__init__.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- from . import res_partner -from . import account_payment_method from . import account_invoice from . import account_move_line diff --git a/account_payment_partner/models/account_invoice.py b/account_payment_partner/models/account_invoice.py index ac7d6827e..14ac17a77 100644 --- a/account_payment_partner/models/account_invoice.py +++ b/account_payment_partner/models/account_invoice.py @@ -29,7 +29,8 @@ class AccountInvoice(models.Model): pay_mode.payment_type == 'outbound' and pay_mode.payment_method_id.bank_account_required and self.commercial_partner_id.bank_ids): - self.partner_bank_id = self.commercial_partner_id.bank_ids[0] + self.partner_bank_id =\ + self.commercial_partner_id.bank_ids[0] elif self.type == 'out_invoice': pay_mode = self.partner_id.customer_payment_mode_id self.payment_mode_id = pay_mode @@ -46,13 +47,11 @@ class AccountInvoice(models.Model): if ( self.payment_mode_id and self.payment_mode_id.payment_type == 'outbound' and - not self.payment_mode_id.payment_method_id.\ - bank_account_required): + not self.payment_mode_id.payment_method_id. + bank_account_required): self.partner_bank_id = False - print "false" elif not self.payment_mode_id: self.partner_bank_id = False - print "false" @api.model def line_get_convert(self, line, part): diff --git a/account_payment_partner/models/account_payment_method.py b/account_payment_partner/models/account_payment_method.py deleted file mode 100644 index 97289f14f..000000000 --- a/account_payment_partner/models/account_payment_method.py +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2016 Akretion (Alexis de Lattre ) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openerp import models, fields - - -class AccountPaymentMethod(models.Model): - _inherit = "account.payment.method" - - bank_account_required = fields.Boolean( - string='Bank Account Required', - help="Activate this option if this payment method requires to " - "set the bank account of your supplier on the vendor bills.") diff --git a/account_payment_partner/views/account_payment_method.xml b/account_payment_partner/views/account_payment_method.xml deleted file mode 100644 index 4f2448ffa..000000000 --- a/account_payment_partner/views/account_payment_method.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - account_payment_partner.account.payment.method.form - account.payment.method - - - - - - - - - - -