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
8b7dca6635
commit
a112af5ce4
@@ -15,10 +15,47 @@ class AccountPaymentLine(models.Model):
|
||||
string='Priority', default='NORM',
|
||||
help="This field will be used as 'Instruction Priority' in "
|
||||
"the generated PAIN file.")
|
||||
# local_instrument is used in some countries, for example
|
||||
# switzerland, cf l10n_ch_sepa that adds some entries in
|
||||
# the selection field
|
||||
# local_instrument is used for instant credit transfers which
|
||||
# will begin on November 2017, cf account_banking_sepa_credit_transfer
|
||||
# It is also used in some countries such as switzerland,
|
||||
# cf l10n_ch_pain_base that adds some entries in the selection field
|
||||
local_instrument = fields.Selection([], string='Local Instrument')
|
||||
category_purpose = fields.Selection([
|
||||
# Full category purpose list found on:
|
||||
# https://www.iso20022.org/external_code_list.page
|
||||
# Document "External Code Sets spreadsheet" version Feb 8th 2017
|
||||
('BONU', 'Bonus Payment'),
|
||||
('CASH', 'Cash Management Transfer'),
|
||||
('CBLK', 'Card Bulk Clearing'),
|
||||
('CCRD', 'Credit Card Payment'),
|
||||
('CORT', 'Trade Settlement Payment'),
|
||||
('DCRD', 'Debit Card Payment'),
|
||||
('DIVI', 'Dividend'),
|
||||
('DVPM', 'Deliver Against Payment'),
|
||||
('EPAY', 'ePayment'),
|
||||
('FCOL', 'Fee Collection'),
|
||||
('GOVT', 'Government Payment'),
|
||||
('HEDG', 'Hedging'),
|
||||
('ICCP', 'Irrevocable Credit Card Payment'),
|
||||
('IDCP', 'Irrevocable Debit Card Payment'),
|
||||
('INTC', 'Intra-Company Payment'),
|
||||
('INTE', 'Interest'),
|
||||
('LOAN', 'Loan'),
|
||||
('OTHR', 'Other Payment'),
|
||||
('PENS', 'Pension Payment'),
|
||||
('RVPM', 'Receive Against Payment'),
|
||||
('SALA', 'Salary Payment'),
|
||||
('SECU', 'Securities'),
|
||||
('SSBE', 'Social Security Benefit'),
|
||||
('SUPP', 'Supplier Payment'),
|
||||
('TAXS', 'Tax Payment'),
|
||||
('TRAD', 'Trade'),
|
||||
('TREA', 'Treasury Payment'),
|
||||
('VATX', 'VAT Payment'),
|
||||
('WHLD', 'WithHolding'),
|
||||
], string="Category Purpose",
|
||||
help="If neither your bank nor your local regulations oblige you to "
|
||||
"set the category purpose, leave the field empty.")
|
||||
# PAIN allows 140 characters
|
||||
communication = fields.Char(size=140)
|
||||
# The field struct_communication_type has been dropped in v9
|
||||
|
||||
@@ -203,8 +203,8 @@ class AccountPaymentOrder(models.Model):
|
||||
@api.model
|
||||
def generate_start_payment_info_block(
|
||||
self, parent_node, payment_info_ident,
|
||||
priority, local_instrument, sequence_type, requested_date,
|
||||
eval_ctx, gen_args):
|
||||
priority, local_instrument, category_purpose, sequence_type,
|
||||
requested_date, eval_ctx, gen_args):
|
||||
payment_info = etree.SubElement(parent_node, 'PmtInf')
|
||||
payment_info_identification = etree.SubElement(
|
||||
payment_info, 'PmtInfId')
|
||||
@@ -249,7 +249,12 @@ class AccountPaymentOrder(models.Model):
|
||||
sequence_type_node = etree.SubElement(
|
||||
payment_type_info, 'SeqTp')
|
||||
sequence_type_node.text = sequence_type
|
||||
|
||||
if category_purpose:
|
||||
category_purpose_node = etree.SubElement(
|
||||
payment_type_info, 'CtgyPurp')
|
||||
category_purpose_code = etree.SubElement(
|
||||
category_purpose_node, 'Cd')
|
||||
category_purpose_code.text = category_purpose
|
||||
if gen_args['payment_method'] == 'DD':
|
||||
request_date_tag = 'ReqdColltnDt'
|
||||
else:
|
||||
|
||||
@@ -13,10 +13,12 @@ class BankPaymentLine(models.Model):
|
||||
local_instrument = fields.Selection(
|
||||
related='payment_line_ids.local_instrument',
|
||||
string='Local Instrument')
|
||||
category_purpose = fields.Selection(
|
||||
related='payment_line_ids.category_purpose', string='Category Purpose')
|
||||
|
||||
@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 += ['priority', 'local_instrument']
|
||||
res += ['priority', 'local_instrument', 'category_purpose']
|
||||
return res
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="communication_type" position="before">
|
||||
<field name="priority"/>
|
||||
<field name="local_instrument" invisible="1"/>
|
||||
<field name="local_instrument"/>
|
||||
<field name="category_purpose"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_bank_id" position="after">
|
||||
<field name="priority"/>
|
||||
<field name="local_instrument" invisible="1"/>
|
||||
<field name="local_instrument"/>
|
||||
<field name="category_purpose"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user