diff --git a/account_banking_mandate/__openerp__.py b/account_banking_mandate/__openerp__.py index 0309a15d2..abee60c18 100644 --- a/account_banking_mandate/__openerp__.py +++ b/account_banking_mandate/__openerp__.py @@ -32,13 +32,14 @@ 'website': 'https://github.com/OCA/bank-payment', 'category': 'Banking addons', 'depends': [ - 'account_payment', + 'account_banking_payment_export', ], 'data': [ 'views/account_banking_mandate_view.xml', 'views/account_invoice_view.xml', 'views/account_payment_view.xml', 'views/res_partner_bank_view.xml', + 'views/bank_payment_line_view.xml', 'data/mandate_reference_sequence.xml', 'data/report_paperformat.xml', 'security/mandate_security.xml', diff --git a/account_banking_mandate/models/__init__.py b/account_banking_mandate/models/__init__.py index 52a6f4616..4b191f0d1 100644 --- a/account_banking_mandate/models/__init__.py +++ b/account_banking_mandate/models/__init__.py @@ -24,3 +24,4 @@ from . import account_banking_mandate from . import account_invoice from . import res_partner_bank from . import payment_line +from . import bank_payment_line diff --git a/account_banking_mandate/models/bank_payment_line.py b/account_banking_mandate/models/bank_payment_line.py new file mode 100644 index 000000000..cb268198c --- /dev/null +++ b/account_banking_mandate/models/bank_payment_line.py @@ -0,0 +1,38 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Mandate module for Odoo +# Copyright (C) 2015 Akretion (http://www.akretion.com) +# @author: Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api + + +class BankPaymentLine(models.Model): + _inherit = 'bank.payment.line' + + mandate_id = fields.Many2one( + comodel_name='account.banking.mandate', string='Direct Debit Mandate', + related='payment_line_ids.mandate_id') + + @api.model + def same_fields_payment_line_and_bank_payment_line(self): + res = super(BankPaymentLine, self).\ + same_fields_payment_line_and_bank_payment_line() + res.append('mandate_id') + return res diff --git a/account_banking_mandate/models/payment_line.py b/account_banking_mandate/models/payment_line.py index 3752dec97..fa044ea29 100644 --- a/account_banking_mandate/models/payment_line.py +++ b/account_banking_mandate/models/payment_line.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Mandate module for openERP +# Mandate module for Odoo # Copyright (C) 2014 Compassion CH (http://www.compassion.ch) # @author: Cyril Sester , # Alexis de Lattre @@ -69,6 +69,8 @@ class PaymentLine(models.Model): "'%s' which is not attached to the mandate '%s' (this " "mandate is attached to the bank account '%s').") % (self.name, - self.bank_id.name_get()[0][1], + self.env['res.partner.bank'].name_get( + [self.bank_id.id])[0][1], self.mandate_id.unique_mandate_reference, - self.mandate_id.partner_bank_id.name_get()[0][1])) + self.env['res.partner.bank'].name_get( + [self.mandate_id.partner_bank_id.id])[0][1])) diff --git a/account_banking_mandate/views/account_payment_view.xml b/account_banking_mandate/views/account_payment_view.xml index 39ec86953..9d2ced2cf 100644 --- a/account_banking_mandate/views/account_payment_view.xml +++ b/account_banking_mandate/views/account_payment_view.xml @@ -10,14 +10,18 @@ mandate.payment.order.form payment.order - + - - + + - + diff --git a/account_banking_mandate/views/bank_payment_line_view.xml b/account_banking_mandate/views/bank_payment_line_view.xml new file mode 100644 index 000000000..25c8656e5 --- /dev/null +++ b/account_banking_mandate/views/bank_payment_line_view.xml @@ -0,0 +1,36 @@ + + + + + + + banking.mandate.bank.payment.line.form + bank.payment.line + + + + + + + + + + banking.mandate.bank.payment.line.tree + bank.payment.line + + + + + + + + + + +