mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Add support for ISO20022 "Category Purpose"
Add local instrument 'INST' for SEPA Instant Credit Transfer
This commit is contained in:
committed by
Pedro M. Baeza
parent
93c73a778b
commit
b5b127049d
@@ -2,3 +2,4 @@
|
||||
|
||||
from . import account_payment_method
|
||||
from . import account_payment_order
|
||||
from . import account_payment_line
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2017 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class AccountPaymentLine(models.Model):
|
||||
_inherit = 'account.payment.line'
|
||||
|
||||
# local_instrument 'INST' used for instant credit transfers
|
||||
# which will begin on November 21st 2017, cf
|
||||
# https://www.europeanpaymentscouncil.eu/document-library/
|
||||
# rulebooks/2017-sepa-instant-credit-transfer-rulebook
|
||||
local_instrument = fields.Selection(
|
||||
selection_add=[('INST', 'Instant Transfer')])
|
||||
@@ -78,34 +78,37 @@ class AccountPaymentOrder(models.Model):
|
||||
transactions_count_a = 0
|
||||
amount_control_sum_a = 0.0
|
||||
lines_per_group = {}
|
||||
# key = (requested_date, priority, local_instrument)
|
||||
# key = (requested_date, priority, local_instrument, categ_purpose)
|
||||
# values = list of lines as object
|
||||
for line in self.bank_line_ids:
|
||||
priority = line.priority
|
||||
local_instrument = line.local_instrument
|
||||
categ_purpose = line.category_purpose
|
||||
# The field line.date is the requested payment date
|
||||
# taking into account the 'date_prefered' setting
|
||||
# cf account_banking_payment_export/models/account_payment.py
|
||||
# in the inherit of action_open()
|
||||
key = (line.date, priority, local_instrument)
|
||||
key = (line.date, priority, local_instrument, categ_purpose)
|
||||
if key in lines_per_group:
|
||||
lines_per_group[key].append(line)
|
||||
else:
|
||||
lines_per_group[key] = [line]
|
||||
for (requested_date, priority, local_instrument), lines in\
|
||||
lines_per_group.items():
|
||||
for (requested_date, priority, local_instrument, categ_purpose),\
|
||||
lines in lines_per_group.items():
|
||||
# B. Payment info
|
||||
payment_info, nb_of_transactions_b, control_sum_b = \
|
||||
self.generate_start_payment_info_block(
|
||||
pain_root,
|
||||
"self.name + '-' "
|
||||
"+ requested_date.replace('-', '') + '-' + priority + "
|
||||
"'-' + local_instrument",
|
||||
priority, local_instrument, False, requested_date, {
|
||||
"'-' + local_instrument + '-' + category_purpose",
|
||||
priority, local_instrument, categ_purpose,
|
||||
False, requested_date, {
|
||||
'self': self,
|
||||
'priority': priority,
|
||||
'requested_date': requested_date,
|
||||
'local_instrument': local_instrument or 'NOinstr',
|
||||
'category_purpose': categ_purpose or 'NOcateg',
|
||||
}, gen_args)
|
||||
self.generate_party_block(
|
||||
payment_info, 'Dbtr', 'B',
|
||||
|
||||
Reference in New Issue
Block a user