mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Add bank.payment.lines object to allow grouping in the payments
This commit is contained in:
committed by
Stefan Rijnhart
parent
5611edadc9
commit
b7bdb4a947
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
38
account_banking_mandate/models/bank_payment_line.py
Normal file
38
account_banking_mandate/models/bank_payment_line.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Mandate module for Odoo
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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
|
||||
@@ -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 <csester@compassion.ch>,
|
||||
# Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
@@ -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]))
|
||||
|
||||
@@ -10,14 +10,18 @@
|
||||
<record id="view_mandate_payment_order_form" model="ir.ui.view">
|
||||
<field name="name">mandate.payment.order.form</field>
|
||||
<field name="model">payment.order</field>
|
||||
<field name="inherit_id" ref="account_payment.view_payment_order_form"/>
|
||||
<field name="inherit_id" ref="account_banking_payment_export.view_payment_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='line_ids']/form/notebook/page/group/field[@name='bank_id']" position="after">
|
||||
<field name="mandate_id" domain="[('partner_bank_id', '=', bank_id), ('state', '=', 'valid')]" invisible="context.get('search_payment_order_type')!='debit'" context="{'default_partner_bank_id': bank_id}"/>
|
||||
<xpath expr="//field[@name='line_ids']/form//field[@name='bank_id']" position="after">
|
||||
<field name="mandate_id"
|
||||
domain="[('partner_bank_id', '=', bank_id), ('state', '=', 'valid')]"
|
||||
invisible="context.get('search_payment_order_type')!='debit'"
|
||||
context="{'default_partner_bank_id': bank_id}"/>
|
||||
<newline />
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='line_ids']/tree/field[@name='bank_id']" position="after">
|
||||
<field name="mandate_id" string="DD Mandate" invisible="context.get('search_payment_order_type')!='debit'"/>
|
||||
<field name="mandate_id" string="Mandate"
|
||||
invisible="context.get('search_payment_order_type')!='debit'"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
36
account_banking_mandate/views/bank_payment_line_view.xml
Normal file
36
account_banking_mandate/views/bank_payment_line_view.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 Akretion (http://www.akretion.com)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="bank_payment_line_form" model="ir.ui.view">
|
||||
<field name="name">banking.mandate.bank.payment.line.form</field>
|
||||
<field name="model">bank.payment.line</field>
|
||||
<field name="inherit_id" ref="account_banking_payment_export.bank_payment_line_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="bank_id" position="after">
|
||||
<field name="mandate_id"
|
||||
invisible="context.get('search_payment_order_type')!='debit'"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="bank_payment_line_tree" model="ir.ui.view">
|
||||
<field name="name">banking.mandate.bank.payment.line.tree</field>
|
||||
<field name="model">bank.payment.line</field>
|
||||
<field name="inherit_id" ref="account_banking_payment_export.bank_payment_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="bank_id" position="after">
|
||||
<field name="mandate_id" string="Mandate"
|
||||
invisible="context.get('search_payment_order_type')!='debit'"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user