From 9f1347a517d3fac9c87fdb5d9c17ddb745dfc5a0 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 10 May 2016 23:16:31 +0200 Subject: [PATCH] Move fields mandate_required and export_ascii from payment mode to payment method Display chatter on payment orders Several small usability improvements --- account_banking_mandate/__openerp__.py | 2 +- account_banking_mandate/models/__init__.py | 5 +---- account_banking_mandate/models/account_invoice.py | 2 +- ...unt_payment_mode.py => account_payment_method.py} | 6 +++--- .../models/account_payment_order.py | 2 +- ...t_payment_mode.xml => account_payment_method.xml} | 12 ++++++------ 6 files changed, 13 insertions(+), 16 deletions(-) rename account_banking_mandate/models/{account_payment_mode.py => account_payment_method.py} (68%) rename account_banking_mandate/views/{account_payment_mode.xml => account_payment_method.xml} (52%) diff --git a/account_banking_mandate/__openerp__.py b/account_banking_mandate/__openerp__.py index a53d4e75b..01242f081 100644 --- a/account_banking_mandate/__openerp__.py +++ b/account_banking_mandate/__openerp__.py @@ -20,7 +20,7 @@ ], 'data': [ 'views/account_banking_mandate_view.xml', - 'views/account_payment_mode.xml', + 'views/account_payment_method.xml', 'views/account_invoice_view.xml', 'views/account_payment_line.xml', 'views/res_partner_bank_view.xml', diff --git a/account_banking_mandate/models/__init__.py b/account_banking_mandate/models/__init__.py index 50af22b59..acec851ac 100644 --- a/account_banking_mandate/models/__init__.py +++ b/account_banking_mandate/models/__init__.py @@ -1,10 +1,7 @@ # -*- coding: utf-8 -*- -# © 2014 Compassion CH - Cyril Sester -# © 2015 Akretion - Alexis de Lattre -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import account_banking_mandate -from . import account_payment_mode +from . import account_payment_method from . import account_payment_order from . import account_invoice from . import res_partner_bank diff --git a/account_banking_mandate/models/account_invoice.py b/account_banking_mandate/models/account_invoice.py index 12afdc33e..23255c58e 100644 --- a/account_banking_mandate/models/account_invoice.py +++ b/account_banking_mandate/models/account_invoice.py @@ -47,7 +47,7 @@ class AccountInvoice(models.Model): if ( self.type in ('out_invoice', 'out_refund') and self.payment_mode_id.payment_type == 'inbound' and - self.payment_mode_id.mandate_required and + self.payment_mode_id.payment_method_id.mandate_required and self.partner_id): mandates = self.env['account.banking.mandate'].search([ ('state', '=', 'valid'), diff --git a/account_banking_mandate/models/account_payment_mode.py b/account_banking_mandate/models/account_payment_method.py similarity index 68% rename from account_banking_mandate/models/account_payment_mode.py rename to account_banking_mandate/models/account_payment_method.py index 6f46ab430..589506a9c 100644 --- a/account_banking_mandate/models/account_payment_mode.py +++ b/account_banking_mandate/models/account_payment_method.py @@ -5,10 +5,10 @@ from openerp import models, fields -class AccountPaymentMode(models.Model): - _inherit = "account.payment.mode" +class AccountPaymentMethod(models.Model): + _inherit = "account.payment.method" mandate_required = fields.Boolean( string='Mandate Required', - help="Activate this option is this payment mode requires your " + help="Activate this option is this payment method requires your " "customer to sign a direct debit mandate with your company.") diff --git a/account_banking_mandate/models/account_payment_order.py b/account_banking_mandate/models/account_payment_order.py index c9f762c95..1d6ef8e7d 100644 --- a/account_banking_mandate/models/account_payment_order.py +++ b/account_banking_mandate/models/account_payment_order.py @@ -12,7 +12,7 @@ class AccountPaymentOrder(models.Model): @api.multi def draft2open(self): for order in self: - if order.payment_mode_id.mandate_required: + if order.payment_mode_id.payment_method_id.mandate_required: for line in order.payment_line_ids: if not line.mandate_id: raise UserError(_( diff --git a/account_banking_mandate/views/account_payment_mode.xml b/account_banking_mandate/views/account_payment_method.xml similarity index 52% rename from account_banking_mandate/views/account_payment_mode.xml rename to account_banking_mandate/views/account_payment_method.xml index 488251185..2d4079533 100644 --- a/account_banking_mandate/views/account_payment_mode.xml +++ b/account_banking_mandate/views/account_payment_method.xml @@ -3,15 +3,15 @@ - - account_banking_mandate.account.payment.mode.form - account.payment.mode - + + account_banking_mandate.account.payment.method.form + account.payment.method + - + - +