mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] Define SEPA identifiers per payment mode
This commit is contained in:
committed by
Pedro M. Baeza
parent
2ef3d06c30
commit
142fa17ecb
@@ -39,7 +39,7 @@ Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* no known issues
|
||||
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
@@ -62,6 +62,7 @@ Contributors
|
||||
* Raphaël Valyi
|
||||
* Sandy Carter
|
||||
* Stefan Rijnhart (Therp)
|
||||
* Antonio Espinosa <antonioea@antiun.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2015 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
'name': 'Account Banking PAIN Base Module',
|
||||
'summary': 'Base module for PAIN file generation',
|
||||
'version': '8.0.0.3.0',
|
||||
'version': '8.0.0.4.0',
|
||||
'license': 'AGPL-3',
|
||||
'author': "Akretion, "
|
||||
"Noviat, "
|
||||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
"Antiun Ingeniería S.L., "
|
||||
"Odoo Community Association (OCA)",
|
||||
'website': 'https://github.com/OCA/bank-payment',
|
||||
'contributors': ['Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>'],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2015 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp import models, api, _
|
||||
@@ -234,12 +235,13 @@ class BankingExportPain(models.AbstractModel):
|
||||
initiating_party_1_8 = etree.SubElement(parent_node, 'InitgPty')
|
||||
initiating_party_name = etree.SubElement(initiating_party_1_8, 'Nm')
|
||||
initiating_party_name.text = my_company_name
|
||||
initiating_party_identifier =\
|
||||
self.payment_order_ids[0].company_id.\
|
||||
initiating_party_identifier
|
||||
initiating_party_issuer =\
|
||||
self.payment_order_ids[0].company_id.\
|
||||
initiating_party_issuer
|
||||
payment = self.payment_order_ids[0]
|
||||
initiating_party_identifier = (
|
||||
payment.mode.initiating_party_identifier or
|
||||
payment.company_id.initiating_party_identifier)
|
||||
initiating_party_issuer = (
|
||||
payment.mode.initiating_party_issuer or
|
||||
payment.company_id.initiating_party_issuer)
|
||||
if initiating_party_identifier and initiating_party_issuer:
|
||||
iniparty_id = etree.SubElement(initiating_party_1_8, 'Id')
|
||||
iniparty_org_id = etree.SubElement(iniparty_id, 'OrgId')
|
||||
@@ -254,7 +256,7 @@ class BankingExportPain(models.AbstractModel):
|
||||
_("Missing 'Initiating Party Issuer' and/or "
|
||||
"'Initiating Party Identifier' for the company '%s'. "
|
||||
"Both fields must have a value.")
|
||||
% self.payment_order_ids[0].company_id.name)
|
||||
% payment.company_id.name)
|
||||
return True
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2015 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp import models, fields
|
||||
from openerp import models, fields, api
|
||||
|
||||
|
||||
class PaymentMode(models.Model):
|
||||
@@ -14,3 +15,35 @@ class PaymentMode(models.Model):
|
||||
help="If active, Odoo will convert each accented caracter to "
|
||||
"the corresponding unaccented caracter, so that only ASCII "
|
||||
"caracters are used in the generated PAIN file.")
|
||||
initiating_party_issuer = fields.Char(
|
||||
string='Initiating Party Issuer', size=35,
|
||||
help="This will be used as the 'Initiating Party Issuer' in the "
|
||||
"PAIN files generated by Odoo. If not defined, Initiating Party "
|
||||
"Issuer from company will be used.\n"
|
||||
"Common format (13): \n"
|
||||
"- Country code (2, optional)\n"
|
||||
"- Company idenfier (N, VAT)\n"
|
||||
"- Service suffix (N, issued by bank)")
|
||||
initiating_party_identifier = fields.Char(
|
||||
string='Initiating Party Identifier', size=35,
|
||||
help="This will be used as the 'Initiating Party Identifier' in "
|
||||
"the PAIN files generated by Odoo. If not defined, Initiating Party "
|
||||
"Identifier from company will be used.\n"
|
||||
"Common format (13): \n"
|
||||
"- Country code (2, optional)\n"
|
||||
"- Company idenfier (N, VAT)\n"
|
||||
"- Service suffix (N, issued by bank)")
|
||||
sepa_type = fields.Char(compute="_compute_sepa_type")
|
||||
|
||||
def _sepa_type_get(self):
|
||||
"""Defined to be inherited by child addons, for instance:
|
||||
- account_banking_sepa_credit_transfer
|
||||
- account_banking_sepa_direct_debit
|
||||
"""
|
||||
return False
|
||||
|
||||
@api.multi
|
||||
@api.depends('type')
|
||||
def _compute_sepa_type(self):
|
||||
for mode in self:
|
||||
mode.sepa_type = mode._sepa_type_get()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<!--
|
||||
Copyright (C) 2013 Akretion (http://www.akretion.com)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
© 2015 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
<openerp>
|
||||
@@ -15,6 +16,16 @@
|
||||
<field name="type" position="after">
|
||||
<field name="convert_to_ascii"/>
|
||||
</field>
|
||||
<xpath expr="//form/group" position="after">
|
||||
<group name="sepa_identifiers" string="SEPA identifiers"
|
||||
attrs="{'invisible': [('sepa_type', '=', False)]}">
|
||||
<field name="sepa_type" invisible="1"/>
|
||||
<group>
|
||||
<field name="initiating_party_identifier" />
|
||||
<field name="initiating_party_issuer"/>
|
||||
</group>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user