mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[RFR] account_banking_sepa_credit_transfer
* Start code factoring between SCT and SDD. * More code factoring between SCT and SDD As a consequence, we now have support for structured remittance info in SDD. * The requested collection date now uses the fields date_prefered and date_scheduled of payment.order, instead of the field in the SDD wizard. * Mutualize more code between SCT and SDD. * Replace unallowed ascii caracters by '-' Update some error messages Update translation files and FR translation Include sepa_export in gen_args Factorize more code between SDD and SCT Fix view of payment lines The modules account_banking_pain_base and account_banking_sepa_* are now fully PEP8 compliant * For SCT, if BIC is not provided, we should not put the 'Creditor Agent' block at all, according to EPC guidelines (on this point, it is different from the Direct Debit !) * Add demo data * Add missing utf-8 header Update state field on SEPA file objects and display it in tree+form views. Migrate form views to version 7.0 and simplify them.
This commit is contained in:
committed by
Carlos Roca
parent
52b624e472
commit
1fc6970ac5
@@ -1,3 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# SEPA Credit Transfer module for OpenERP
|
||||
@@ -29,23 +30,34 @@
|
||||
'depends': ['account_banking_pain_base'],
|
||||
'external_dependencies': {
|
||||
'python': ['unidecode', 'lxml'],
|
||||
},
|
||||
},
|
||||
'data': [
|
||||
'account_banking_sepa_view.xml',
|
||||
'wizard/export_sepa_view.xml',
|
||||
'data/payment_type_sepa_sct.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'demo': ['sepa_credit_transfer_demo.xml'],
|
||||
'description': '''
|
||||
Module to export payment orders in SEPA XML file format.
|
||||
|
||||
SEPA PAIN (PAyment INitiation) is the new european standard for Customer-to-Bank payment instructions. This module implements SEPA Credit Transfer (SCT), more specifically PAIN versions 001.001.02, 001.001.03, 001.001.04 and 001.001.05. It is part of the ISO 20022 standard, available on http://www.iso20022.org.
|
||||
SEPA PAIN (PAyment INitiation) is the new european standard for
|
||||
Customer-to-Bank payment instructions.
|
||||
|
||||
The Implementation Guidelines for SEPA Credit Transfer published by the European Payments Council (http://http://www.europeanpaymentscouncil.eu) use PAIN version 001.001.03, so it's probably the version of PAIN that you should try first.
|
||||
This module implements SEPA Credit Transfer (SCT), more specifically PAIN
|
||||
versions 001.001.02, 001.001.03, 001.001.04 and 001.001.05.
|
||||
It is part of the ISO 20022 standard, available on http://www.iso20022.org.
|
||||
|
||||
This module uses the framework provided by the banking addons, cf https://launchpad.net/banking-addons
|
||||
The Implementation Guidelines for SEPA Credit Transfer published by the
|
||||
European Payments Council (http://http://www.europeanpaymentscouncil.eu)
|
||||
use PAIN version 001.001.03, so it's probably the version of PAIN that you
|
||||
should try first.
|
||||
|
||||
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
|
||||
This module uses the framework provided by the banking addons,
|
||||
cf https://www.github.com/OCA/banking-addons
|
||||
|
||||
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
|
||||
for any help or question about this module.
|
||||
''',
|
||||
'active': False,
|
||||
'installable': True,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# SEPA Credit Transfer module for OpenERP
|
||||
@@ -50,18 +51,29 @@ class banking_export_sepa(orm.Model):
|
||||
readonly=True),
|
||||
'nb_transactions': fields.integer(
|
||||
'Number of Transactions', readonly=True),
|
||||
'total_amount': fields.float('Total Amount',
|
||||
digits_compute=dp.get_precision('Account'), readonly=True),
|
||||
'total_amount': fields.float(
|
||||
'Total Amount', digits_compute=dp.get_precision('Account'),
|
||||
readonly=True),
|
||||
'batch_booking': fields.boolean(
|
||||
'Batch Booking', readonly=True,
|
||||
help="If true, the bank statement will display only one debit line for all the wire transfers of the SEPA XML file ; if false, the bank statement will display one debit line per wire transfer of the SEPA XML file."),
|
||||
help="If true, the bank statement will display only one debit "
|
||||
"line for all the wire transfers of the SEPA XML file ; "
|
||||
"if false, the bank statement will display one debit line "
|
||||
"per wire transfer of the SEPA XML file."),
|
||||
'charge_bearer': fields.selection([
|
||||
('SLEV', 'Following Service Level'),
|
||||
('SHAR', 'Shared'),
|
||||
('CRED', 'Borne by Creditor'),
|
||||
('DEBT', 'Borne by Debtor'),
|
||||
], 'Charge Bearer', readonly=True,
|
||||
help='Following service level : transaction charges are to be applied following the rules agreed in the service level and/or scheme (SEPA Core messages must use this). Shared : transaction charges on the creditor side are to be borne by the creditor, transaction charges on the debtor side are to be borne by the debtor. Borne by creditor : all transaction charges are to be borne by the creditor. Borne by debtor : all transaction charges are to be borne by the debtor.'),
|
||||
help="Following service level : transaction charges are to be "
|
||||
"applied following the rules agreed in the service level and/or "
|
||||
"scheme (SEPA Core messages must use this). Shared : "
|
||||
"transaction charges on the creditor side are to be borne by "
|
||||
"the creditor, transaction charges on the debtor side are to "
|
||||
"be borne by the debtor. Borne by creditor : all transaction "
|
||||
"charges are to be borne by the creditor. Borne by debtor : "
|
||||
"all transaction charges are to be borne by the debtor."),
|
||||
'create_date': fields.datetime('Generation Date', readonly=True),
|
||||
'file': fields.binary('SEPA XML File', readonly=True),
|
||||
'filename': fields.function(
|
||||
@@ -70,7 +82,6 @@ class banking_export_sepa(orm.Model):
|
||||
'state': fields.selection([
|
||||
('draft', 'Draft'),
|
||||
('sent', 'Sent'),
|
||||
('done', 'Reconciled'),
|
||||
], 'State', readonly=True),
|
||||
}
|
||||
|
||||
|
||||
@@ -11,28 +11,24 @@
|
||||
<field name="name">account.banking.export.sepa.form</field>
|
||||
<field name="model">banking.export.sepa</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="SEPA Credit Transfer">
|
||||
<form string="SEPA Credit Transfer" version="7.0">
|
||||
<header>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<notebook>
|
||||
<page string="General Information">
|
||||
<field name="total_amount" />
|
||||
<field name="nb_transactions" />
|
||||
<field name="batch_booking" />
|
||||
<field name="charge_bearer"/>
|
||||
<field name="create_date" />
|
||||
<newline />
|
||||
<field name="file" filename="filename"/>
|
||||
<field name="filename" invisible="True"/>
|
||||
<group name="main">
|
||||
<field name="total_amount" />
|
||||
<field name="nb_transactions" />
|
||||
<field name="batch_booking" />
|
||||
<field name="charge_bearer"/>
|
||||
<field name="create_date" />
|
||||
<field name="file" filename="filename"/>
|
||||
<field name="filename" invisible="True"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Payment Orders">
|
||||
<field name="payment_order_ids" colspan="4" nolabel="1">
|
||||
<tree colors="blue:state in ('draft');gray:state in ('cancel','done');black:state in ('open')" string="Payment Orders">
|
||||
<field name="reference"/>
|
||||
<field name="date_created"/>
|
||||
<field name="date_done"/>
|
||||
<field name="total"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="payment_order_ids" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
@@ -48,6 +44,7 @@
|
||||
<field name="filename"/>
|
||||
<field name="create_date"/>
|
||||
<field name="nb_transactions"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -6,8 +6,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2013-11-13 09:13+0000\n"
|
||||
"PO-Revision-Date: 2013-11-13 09:13+0000\n"
|
||||
"POT-Creation-Date: 2013-12-23 22:49+0000\n"
|
||||
"PO-Revision-Date: 2013-12-23 22:49+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -15,12 +15,6 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: field:banking.export.sepa,prefered_exec_date:0
|
||||
#: field:banking.export.sepa.wizard,prefered_exec_date:0
|
||||
msgid "Prefered Execution Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa.wizard,state:0
|
||||
msgid "Create"
|
||||
@@ -54,12 +48,6 @@ msgstr ""
|
||||
msgid "Following service level : transaction charges are to be applied following the rules agreed in the service level and/or scheme (SEPA Core messages must use this). Shared : transaction charges on the debtor side are to be borne by the debtor, transaction charges on the creditor side are to be borne by the creditor. Borne by creditor : all transaction charges are to be borne by the creditor. Borne by debtor : all transaction charges are to be borne by the debtor."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:117
|
||||
#, python-format
|
||||
msgid "Cannot compute the '%s' of the Payment Line with Invoice Reference '%s'."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa,charge_bearer:0
|
||||
#: selection:banking.export.sepa.wizard,charge_bearer:0
|
||||
@@ -72,9 +60,14 @@ msgstr ""
|
||||
msgid "Batch Booking"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa,state:0
|
||||
msgid "Sent"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_banking_export_sepa_wizard
|
||||
msgid "Export SEPA Credit Transfer XML file"
|
||||
msgid "Export SEPA Credit Transfer File"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
@@ -104,23 +97,6 @@ msgstr ""
|
||||
msgid "Borne by Creditor"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:122
|
||||
#, python-format
|
||||
msgid "Cannot compute the '%s'."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:126
|
||||
#, python-format
|
||||
msgid "The type of the field '%s' is %s. It should be a string or unicode."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa,state:0
|
||||
msgid "Sent"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: view:banking.export.sepa.wizard:0
|
||||
msgid "Validate"
|
||||
@@ -131,12 +107,6 @@ msgstr ""
|
||||
msgid "Generate"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:169
|
||||
#, python-format
|
||||
msgid "The generated XML file is not valid against the official XML Schema Definition. The generated XML file and the full error have been written in the server logs. Here is the error, which may give you an idea on the cause of the problem : %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa,charge_bearer:0
|
||||
#: selection:banking.export.sepa.wizard,charge_bearer:0
|
||||
@@ -144,13 +114,8 @@ msgid "Borne by Debtor"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:90
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:116
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:121
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:130
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:168
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:206
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:350
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:128
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:245
|
||||
#, python-format
|
||||
msgid "Error:"
|
||||
msgstr ""
|
||||
@@ -172,19 +137,13 @@ msgstr ""
|
||||
msgid "SEPA File Generation"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:125
|
||||
#, python-format
|
||||
msgid "Field type error:"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_banking_export_sepa
|
||||
msgid "SEPA export"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:351
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:246
|
||||
#, python-format
|
||||
msgid "Missing Bank Account on invoice '%s' (payment order line reference '%s')."
|
||||
msgstr ""
|
||||
@@ -195,29 +154,17 @@ msgstr ""
|
||||
msgid "SEPA XML File"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:131
|
||||
#, python-format
|
||||
msgid "The '%s' is empty or 0. It should have a non-null value."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: help:banking.export.sepa,charge_bearer:0
|
||||
msgid "Following service level : transaction charges are to be applied following the rules agreed in the service level and/or scheme (SEPA Core messages must use this). Shared : transaction charges on the creditor side are to be borne by the creditor, transaction charges on the debtor side are to be borne by the debtor. Borne by creditor : all transaction charges are to be borne by the creditor. Borne by debtor : all transaction charges are to be borne by the debtor."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:207
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:129
|
||||
#, python-format
|
||||
msgid "Payment Type Code '%s' is not supported. The only Payment Type Codes supported for SEPA Credit Transfers are 'pain.001.001.02', 'pain.001.001.03', 'pain.001.001.04' and 'pain.001.001.05'."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:90
|
||||
#, python-format
|
||||
msgid "This IBAN is not valid : %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: view:banking.export.sepa:0
|
||||
#: field:banking.export.sepa,payment_order_ids:0
|
||||
@@ -243,11 +190,6 @@ msgstr ""
|
||||
msgid "If true, the bank statement will display only one debit line for all the wire transfers of the SEPA XML file ; if false, the bank statement will display one debit line per wire transfer of the SEPA XML file."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: help:banking.export.sepa.wizard,prefered_exec_date:0
|
||||
msgid "This is the date on which the file should be processed by the bank. Please keep in mind that banks only execute on working days and typically use a delay of two days between execution date and effective transfer date."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: field:banking.export.sepa.wizard,file:0
|
||||
msgid "File"
|
||||
|
||||
@@ -6,21 +6,14 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2013-11-13 09:13+0000\n"
|
||||
"PO-Revision-Date: 2013-12-02 16:36+0000\n"
|
||||
"Last-Translator: Alexis de Lattre <alexis@via.ecp.fr>\n"
|
||||
"POT-Creation-Date: 2013-12-23 22:52+0000\n"
|
||||
"PO-Revision-Date: 2013-12-23 22:52+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2013-12-03 06:20+0000\n"
|
||||
"X-Generator: Launchpad (build 16856)\n"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: field:banking.export.sepa,prefered_exec_date:0
|
||||
#: field:banking.export.sepa.wizard,prefered_exec_date:0
|
||||
msgid "Prefered Execution Date"
|
||||
msgstr "Date d'exécution demandée"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa.wizard,state:0
|
||||
@@ -52,31 +45,8 @@ msgstr "Brouillon"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: help:banking.export.sepa.wizard,charge_bearer:0
|
||||
msgid ""
|
||||
"Following service level : transaction charges are to be applied following "
|
||||
"the rules agreed in the service level and/or scheme (SEPA Core messages must "
|
||||
"use this). Shared : transaction charges on the debtor side are to be borne "
|
||||
"by the debtor, transaction charges on the creditor side are to be borne by "
|
||||
"the creditor. Borne by creditor : all transaction charges are to be borne by "
|
||||
"the creditor. Borne by debtor : all transaction charges are to be borne by "
|
||||
"the debtor."
|
||||
msgstr ""
|
||||
"Suivant le niveau de service : la répartition des frais bancaires suit les "
|
||||
"règles pré-établies dans le schema ou dans le contrat avec la banque (les "
|
||||
"messages SEPA Core doivent utiliser ce paramètre). Partagés : les frais "
|
||||
"bancaires côté débiteur sont à la charge du débiteur, les frais bancaires "
|
||||
"côté créancier sont à la charge du créancier. Supportés par le créancier : "
|
||||
"tous les frais bancaires sont à la charge du créancier. Supportés par le "
|
||||
"débiteur : tous les frais bancaires sont à la charge du débiteur."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:117
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Cannot compute the '%s' of the Payment Line with Invoice Reference '%s'."
|
||||
msgstr ""
|
||||
"Impossible de générer le '%s' de la ligne de paiement ayant la référence de "
|
||||
"facture '%s'."
|
||||
msgid "Following service level : transaction charges are to be applied following the rules agreed in the service level and/or scheme (SEPA Core messages must use this). Shared : transaction charges on the debtor side are to be borne by the debtor, transaction charges on the creditor side are to be borne by the creditor. Borne by creditor : all transaction charges are to be borne by the creditor. Borne by debtor : all transaction charges are to be borne by the debtor."
|
||||
msgstr "Suivant le niveau de service : la répartition des frais bancaires suit les règles pré-établies dans le schema ou dans le contrat avec la banque (les messages SEPA Core doivent utiliser ce paramètre). Partagés : les frais bancaires côté débiteur sont à la charge du débiteur, les frais bancaires côté créancier sont à la charge du créancier. Supportés par le créancier : tous les frais bancaires sont à la charge du créancier. Supportés par le débiteur : tous les frais bancaires sont à la charge du débiteur."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa,charge_bearer:0
|
||||
@@ -90,10 +60,15 @@ msgstr "Partagé"
|
||||
msgid "Batch Booking"
|
||||
msgstr "Débit groupé"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa,state:0
|
||||
msgid "Sent"
|
||||
msgstr "Envoyé"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_banking_export_sepa_wizard
|
||||
msgid "Export SEPA Credit Transfer XML file"
|
||||
msgstr "Exporte the fichier de virement SEPA XML"
|
||||
msgid "Export SEPA Credit Transfer File"
|
||||
msgstr "Exporte le fichier de virement SEPA"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: view:banking.export.sepa:0
|
||||
@@ -122,24 +97,6 @@ msgstr "Suivant le niveau de service"
|
||||
msgid "Borne by Creditor"
|
||||
msgstr "Supportés par le destinataire"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:122
|
||||
#, python-format
|
||||
msgid "Cannot compute the '%s'."
|
||||
msgstr "Impossible de générer le '%s'."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:126
|
||||
#, python-format
|
||||
msgid "The type of the field '%s' is %s. It should be a string or unicode."
|
||||
msgstr ""
|
||||
"Le champ '%s' est de type %s. Le type devrait être string ou unicode."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa,state:0
|
||||
msgid "Sent"
|
||||
msgstr "Envoyé"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: view:banking.export.sepa.wizard:0
|
||||
msgid "Validate"
|
||||
@@ -150,20 +107,6 @@ msgstr "Valider"
|
||||
msgid "Generate"
|
||||
msgstr "Générer"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:169
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The generated XML file is not valid against the official XML Schema "
|
||||
"Definition. The generated XML file and the full error have been written in "
|
||||
"the server logs. Here is the error, which may give you an idea on the cause "
|
||||
"of the problem : %s"
|
||||
msgstr ""
|
||||
"Le fichier XML généré n'est pas valide par rapport à la Définition du Schéma "
|
||||
"XML officiel. Le fichier XML généré et le message d'erreur complet ont été "
|
||||
"écrits dans les logs du serveur. Voici l'erreur, qui vous donnera peut-être "
|
||||
"une idée sur la cause du problème : %s"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:banking.export.sepa,charge_bearer:0
|
||||
#: selection:banking.export.sepa.wizard,charge_bearer:0
|
||||
@@ -171,13 +114,8 @@ msgid "Borne by Debtor"
|
||||
msgstr "Supportés par l'émetteur"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:90
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:116
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:121
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:130
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:168
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:206
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:350
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:128
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:245
|
||||
#, python-format
|
||||
msgid "Error:"
|
||||
msgstr "Erreur :"
|
||||
@@ -199,25 +137,16 @@ msgstr "Répartition des frais"
|
||||
msgid "SEPA File Generation"
|
||||
msgstr "Génération du fichier SEPA"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:125
|
||||
#, python-format
|
||||
msgid "Field type error:"
|
||||
msgstr "Erreur dans le type de champ:"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_banking_export_sepa
|
||||
msgid "SEPA export"
|
||||
msgstr "Export SEPA"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:351
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:246
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Missing Bank Account on invoice '%s' (payment order line reference '%s')."
|
||||
msgstr ""
|
||||
"Compte bancaire manquant sur la facture '%s' (référence de la ligne de "
|
||||
"paiement : '%s')."
|
||||
msgid "Missing Bank Account on invoice '%s' (payment order line reference '%s')."
|
||||
msgstr "Compte bancaire manquant sur la facture '%s' (référence de la ligne de paiement : '%s')."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: field:banking.export.sepa,file:0
|
||||
@@ -225,48 +154,16 @@ msgstr ""
|
||||
msgid "SEPA XML File"
|
||||
msgstr "Fichier SEPA XML"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:131
|
||||
#, python-format
|
||||
msgid "The '%s' is empty or 0. It should have a non-null value."
|
||||
msgstr "Le '%s' est vide ou égal à 0. La valeur devrait être non nulle."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: help:banking.export.sepa,charge_bearer:0
|
||||
msgid ""
|
||||
"Following service level : transaction charges are to be applied following "
|
||||
"the rules agreed in the service level and/or scheme (SEPA Core messages must "
|
||||
"use this). Shared : transaction charges on the creditor side are to be borne "
|
||||
"by the creditor, transaction charges on the debtor side are to be borne by "
|
||||
"the debtor. Borne by creditor : all transaction charges are to be borne by "
|
||||
"the creditor. Borne by debtor : all transaction charges are to be borne by "
|
||||
"the debtor."
|
||||
msgstr ""
|
||||
"Suivant le niveau de service : la répartition des frais bancaires suit les "
|
||||
"règles pré-établies dans le schema ou dans le contrat avec la banque (les "
|
||||
"messages SEPA Core doivent utiliser ce paramètre). Partagés : les frais "
|
||||
"bancaires côté débiteur sont à la charge du débiteur, les frais bancaires "
|
||||
"côté créancier sont à la charge du créancier. Supportés par le créancier : "
|
||||
"tous les frais bancaires sont à la charge du créancier. Supportés par le "
|
||||
"débiteur : tous les frais bancaires sont à la charge du débiteur."
|
||||
msgid "Following service level : transaction charges are to be applied following the rules agreed in the service level and/or scheme (SEPA Core messages must use this). Shared : transaction charges on the creditor side are to be borne by the creditor, transaction charges on the debtor side are to be borne by the debtor. Borne by creditor : all transaction charges are to be borne by the creditor. Borne by debtor : all transaction charges are to be borne by the debtor."
|
||||
msgstr "Suivant le niveau de service : la répartition des frais bancaires suit les règles pré-établies dans le schema ou dans le contrat avec la banque (les messages SEPA Core doivent utiliser ce paramètre). Partagés : les frais bancaires côté débiteur sont à la charge du débiteur, les frais bancaires côté créancier sont à la charge du créancier. Supportés par le créancier : tous les frais bancaires sont à la charge du créancier. Supportés par le débiteur : tous les frais bancaires sont à la charge du débiteur."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:207
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:129
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Payment Type Code '%s' is not supported. The only Payment Type Codes "
|
||||
"supported for SEPA Credit Transfers are 'pain.001.001.02', "
|
||||
"'pain.001.001.03', 'pain.001.001.04' and 'pain.001.001.05'."
|
||||
msgstr ""
|
||||
"Le code du Type de paiement '%s' n'est pas supporté. Les seuls codes de Type "
|
||||
"de paiement supportés pour les virements SEPA sont 'pain.001.001.02', "
|
||||
"'pain.001.001.03', 'pain.001.001.04' et 'pain.001.001.05'."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/wizard/export_sepa.py:90
|
||||
#, python-format
|
||||
msgid "This IBAN is not valid : %s"
|
||||
msgstr "Cet IBAN n'est pas valide : %s"
|
||||
msgid "Payment Type Code '%s' is not supported. The only Payment Type Codes supported for SEPA Credit Transfers are 'pain.001.001.02', 'pain.001.001.03', 'pain.001.001.04' and 'pain.001.001.05'."
|
||||
msgstr "Le code du Type de paiement '%s' n'est pas supporté. Les seuls codes de Type de paiement supportés pour les virements SEPA sont 'pain.001.001.02', 'pain.001.001.03', 'pain.001.001.04' et 'pain.001.001.05'."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: view:banking.export.sepa:0
|
||||
@@ -290,26 +187,8 @@ msgstr "Fichiers de virement SEPA"
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: help:banking.export.sepa,batch_booking:0
|
||||
#: help:banking.export.sepa.wizard,batch_booking:0
|
||||
msgid ""
|
||||
"If true, the bank statement will display only one debit line for all the "
|
||||
"wire transfers of the SEPA XML file ; if false, the bank statement will "
|
||||
"display one debit line per wire transfer of the SEPA XML file."
|
||||
msgstr ""
|
||||
"Si coché, le relevé de compte ne comportera qu'une ligne de débit pour tous "
|
||||
"les virements du fichier SEPA XML ; si non coché, le relevé de compte "
|
||||
"comportera une ligne de débit pour chaque virement du fichier SEPA XML."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: help:banking.export.sepa.wizard,prefered_exec_date:0
|
||||
msgid ""
|
||||
"This is the date on which the file should be processed by the bank. Please "
|
||||
"keep in mind that banks only execute on working days and typically use a "
|
||||
"delay of two days between execution date and effective transfer date."
|
||||
msgstr ""
|
||||
"C'est la date à laquelle le fichier doit être traité par la banque. Gardez "
|
||||
"en tête que les banques réalisent des traitements seulement les jours ouvrés "
|
||||
"et ont habituellement un délai de 2 jours entre la date de traitement et la "
|
||||
"date du transfert effectif."
|
||||
msgid "If true, the bank statement will display only one debit line for all the wire transfers of the SEPA XML file ; if false, the bank statement will display one debit line per wire transfer of the SEPA XML file."
|
||||
msgstr "Si coché, le relevé de compte ne comportera qu'une ligne de débit pour tous les virements du fichier SEPA XML ; si non coché, le relevé de compte comportera une ligne de débit pour chaque virement du fichier SEPA XML."
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: field:banking.export.sepa.wizard,file:0
|
||||
@@ -326,88 +205,3 @@ msgstr "Annuler"
|
||||
msgid "Generation Date"
|
||||
msgstr "Date de génération"
|
||||
|
||||
#~ msgid "SEPA XML file"
|
||||
#~ msgstr "Fichier SEPA XML"
|
||||
|
||||
#~ msgid "Payment order"
|
||||
#~ msgstr "Ordre de paiement"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "This is the message identification of the entire SEPA XML file. 35 "
|
||||
#~ "characters max."
|
||||
#~ msgstr ""
|
||||
#~ "Ceci est le libellé d'identification du fichier SEPA XML. 35 caractères "
|
||||
#~ "maximum."
|
||||
|
||||
#~ msgid "Prefered execution date"
|
||||
#~ msgstr "Date d'exécution demandée"
|
||||
|
||||
#~ msgid "Generation date"
|
||||
#~ msgstr "Date de génération"
|
||||
|
||||
#~ msgid "Message identification"
|
||||
#~ msgstr "Libellé d'identification"
|
||||
|
||||
#~ msgid "Total amount"
|
||||
#~ msgstr "Montant total"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Shared : transaction charges on the sender side are to be borne by the "
|
||||
#~ "debtor, transaction charges on the receiver side are to be borne by the "
|
||||
#~ "creditor (most transfers use this). Borne by creditor : all transaction "
|
||||
#~ "charges are to be borne by the creditor. Borne by debtor : all transaction "
|
||||
#~ "charges are to be borne by the debtor. Following service level : transaction "
|
||||
#~ "charges are to be applied following the rules agreed in the service level "
|
||||
#~ "and/or scheme."
|
||||
#~ msgstr ""
|
||||
#~ "Partagés : les frais bancaires côté émetteur sont à la charge de l'émetteur "
|
||||
#~ "et les frais bancaires côté destinataire sont à la charge du destinataire "
|
||||
#~ "(la plupart des virements utilisent cette répartition). Supportés par le "
|
||||
#~ "destinataire : tous les frais bancaires sont à la charge du destinataire. "
|
||||
#~ "Supportés par l'émetteur : tous les frais bancaires sont à la charge de "
|
||||
#~ "l'émetteur. Suivant le niveau de service : la répartition des frais "
|
||||
#~ "bancaires suit les règles pré-établies dans le contrat avec la banque."
|
||||
|
||||
#~ msgid "Borne by creditor"
|
||||
#~ msgstr "Supportés par le destinataire"
|
||||
|
||||
#~ msgid "Payment orders"
|
||||
#~ msgstr "Ordres de paiement"
|
||||
|
||||
#~ msgid "SEPA XML file generation"
|
||||
#~ msgstr "Génération du fichier SEPA XML"
|
||||
|
||||
#~ msgid "Reference for further communication"
|
||||
#~ msgstr "Référence pour communication ultérieure"
|
||||
|
||||
#~ msgid "Processing details"
|
||||
#~ msgstr "Paramètres"
|
||||
|
||||
#~ msgid "Borne by debtor"
|
||||
#~ msgstr "Supportés par l'émetteur"
|
||||
|
||||
#~ msgid "Number of transactions"
|
||||
#~ msgstr "Nombre de transactions"
|
||||
|
||||
#~ msgid "Following service level"
|
||||
#~ msgstr "Suivant le niveau de service"
|
||||
|
||||
#~ msgid "Charge bearer"
|
||||
#~ msgstr "Répartition des frais"
|
||||
|
||||
#, python-format
|
||||
#~ msgid ""
|
||||
#~ "Payment Type Code '%s' is not supported. The only Payment Type Codes "
|
||||
#~ "supported for SEPA Credit Transfers are 'pain.001.001.02', 'pain.001.001.03' "
|
||||
#~ "and 'pain.001.001.04'."
|
||||
#~ msgstr ""
|
||||
#~ "Le code '%s' pour le Type de Paiment n'est pas supporté. Les seuls codes de "
|
||||
#~ "Types de Paiement supportés pour les virements SEPA sont 'pain.001.001.02', "
|
||||
#~ "'pain.001.001.03' et 'pain.001.001.04'."
|
||||
|
||||
#, python-format
|
||||
#~ msgid "Error :"
|
||||
#~ msgstr "Erreur :"
|
||||
|
||||
#~ msgid "Batch booking"
|
||||
#~ msgstr "Débit groupé"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="sepa_credit_transfer_mode" model="payment.mode">
|
||||
<field name="name">SEPA Credit Transfer La Banque Postale</field>
|
||||
<field name="journal" ref="account.bank_journal"/>
|
||||
<field name="bank_id" ref="account_banking_payment_export.main_company_iban"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="type" ref="export_sepa_sct_001_001_03"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -22,20 +22,14 @@
|
||||
|
||||
|
||||
from openerp.osv import orm, fields
|
||||
import base64
|
||||
from datetime import datetime
|
||||
from openerp.tools.translate import _
|
||||
from openerp.tools.safe_eval import safe_eval
|
||||
from openerp import tools, netsvc
|
||||
from openerp import netsvc
|
||||
from lxml import etree
|
||||
import logging
|
||||
from unidecode import unidecode
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class banking_export_sepa_wizard(orm.TransientModel):
|
||||
_name = 'banking.export.sepa.wizard'
|
||||
_inherit = ['banking.export.pain']
|
||||
_description = 'Export SEPA Credit Transfer File'
|
||||
|
||||
_columns = {
|
||||
@@ -45,14 +39,24 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
], 'State', readonly=True),
|
||||
'batch_booking': fields.boolean(
|
||||
'Batch Booking',
|
||||
help="If true, the bank statement will display only one debit line for all the wire transfers of the SEPA XML file ; if false, the bank statement will display one debit line per wire transfer of the SEPA XML file."),
|
||||
help="If true, the bank statement will display only one debit "
|
||||
"line for all the wire transfers of the SEPA XML file ; if "
|
||||
"false, the bank statement will display one debit line per wire "
|
||||
"transfer of the SEPA XML file."),
|
||||
'charge_bearer': fields.selection([
|
||||
('SLEV', 'Following Service Level'),
|
||||
('SHAR', 'Shared'),
|
||||
('CRED', 'Borne by Creditor'),
|
||||
('DEBT', 'Borne by Debtor'),
|
||||
], 'Charge Bearer', required=True,
|
||||
help='Following service level : transaction charges are to be applied following the rules agreed in the service level and/or scheme (SEPA Core messages must use this). Shared : transaction charges on the debtor side are to be borne by the debtor, transaction charges on the creditor side are to be borne by the creditor. Borne by creditor : all transaction charges are to be borne by the creditor. Borne by debtor : all transaction charges are to be borne by the debtor.'),
|
||||
help="Following service level : transaction charges are to be "
|
||||
"applied following the rules agreed in the service level and/or "
|
||||
"scheme (SEPA Core messages must use this). Shared : transaction "
|
||||
"charges on the debtor side are to be borne by the debtor, "
|
||||
"transaction charges on the creditor side are to be borne by "
|
||||
"the creditor. Borne by creditor : all transaction charges are "
|
||||
"to be borne by the creditor. Borne by debtor : all transaction "
|
||||
"charges are to be borne by the debtor."),
|
||||
'nb_transactions': fields.related(
|
||||
'file_id', 'nb_transactions', type='integer',
|
||||
string='Number of Transactions', readonly=True),
|
||||
@@ -76,16 +80,6 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
'state': 'create',
|
||||
}
|
||||
|
||||
def _validate_iban(self, cr, uid, iban, context=None):
|
||||
'''if IBAN is valid, returns IBAN
|
||||
if IBAN is NOT valid, raises an error message'''
|
||||
partner_bank_obj = self.pool.get('res.partner.bank')
|
||||
if partner_bank_obj.is_iban_valid(cr, uid, iban, context=context):
|
||||
return iban.replace(' ', '')
|
||||
else:
|
||||
raise orm.except_orm(
|
||||
_('Error:'), _("This IBAN is not valid : %s") % iban)
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
payment_order_ids = context.get('active_ids', [])
|
||||
vals.update({
|
||||
@@ -94,81 +88,6 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
return super(banking_export_sepa_wizard, self).create(
|
||||
cr, uid, vals, context=context)
|
||||
|
||||
def _prepare_field(
|
||||
self, cr, uid, field_name, field_value, eval_ctx, max_size=0,
|
||||
convert_to_ascii=False, context=None):
|
||||
'''This function is designed to be inherited !'''
|
||||
assert isinstance(eval_ctx, dict), 'eval_ctx must contain a dict'
|
||||
try:
|
||||
value = safe_eval(field_value, eval_ctx)
|
||||
# SEPA uses XML ; XML = UTF-8 ; UTF-8 = support for all characters
|
||||
# But we are dealing with banks...
|
||||
# and many banks don't want non-ASCCI characters !
|
||||
# cf section 1.4 "Character set" of the SEPA Credit Transfer
|
||||
# Scheme Customer-to-bank guidelines
|
||||
if convert_to_ascii:
|
||||
value = unidecode(value)
|
||||
except:
|
||||
line = eval_ctx.get('line')
|
||||
if line:
|
||||
raise orm.except_orm(
|
||||
_('Error:'),
|
||||
_("Cannot compute the '%s' of the Payment Line with Invoice Reference '%s'.")
|
||||
% (field_name, self.pool['account.invoice'].name_get(
|
||||
cr, uid, [line.ml_inv_ref.id], context=context)[0][1]))
|
||||
else:
|
||||
raise orm.except_orm(
|
||||
_('Error:'),
|
||||
_("Cannot compute the '%s'.") % field_name)
|
||||
if not isinstance(value, (str, unicode)):
|
||||
raise orm.except_orm(
|
||||
_('Field type error:'),
|
||||
_("The type of the field '%s' is %s. It should be a string or unicode.")
|
||||
% (field_name, type(value)))
|
||||
if not value:
|
||||
raise orm.except_orm(
|
||||
_('Error:'),
|
||||
_("The '%s' is empty or 0. It should have a non-null value.")
|
||||
% field_name)
|
||||
if max_size and len(value) > max_size:
|
||||
value = value[0:max_size]
|
||||
return value
|
||||
|
||||
def _prepare_export_sepa(
|
||||
self, cr, uid, sepa_export, total_amount, transactions_count,
|
||||
xml_string, context=None):
|
||||
return {
|
||||
'batch_booking': sepa_export.batch_booking,
|
||||
'charge_bearer': sepa_export.charge_bearer,
|
||||
'total_amount': total_amount,
|
||||
'nb_transactions': transactions_count,
|
||||
'file': base64.encodestring(xml_string),
|
||||
'payment_order_ids': [
|
||||
(6, 0, [x.id for x in sepa_export.payment_order_ids])
|
||||
],
|
||||
}
|
||||
|
||||
def _validate_xml(self, cr, uid, xml_string, pain_flavor):
|
||||
xsd_etree_obj = etree.parse(
|
||||
tools.file_open(
|
||||
'account_banking_sepa_credit_transfer/data/%s.xsd'
|
||||
% pain_flavor))
|
||||
official_pain_schema = etree.XMLSchema(xsd_etree_obj)
|
||||
|
||||
try:
|
||||
root_to_validate = etree.fromstring(xml_string)
|
||||
official_pain_schema.assertValid(root_to_validate)
|
||||
except Exception, e:
|
||||
_logger.warning(
|
||||
"The XML file is invalid against the XML Schema Definition")
|
||||
_logger.warning(xml_string)
|
||||
_logger.warning(e)
|
||||
raise orm.except_orm(
|
||||
_('Error:'),
|
||||
_('The generated XML file is not valid against the official XML Schema Definition. The generated XML file and the full error have been written in the server logs. Here is the error, which may give you an idea on the cause of the problem : %s')
|
||||
% str(e))
|
||||
return True
|
||||
|
||||
def create_sepa(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
Creates the SEPA Credit Transfer file. That's the important code !
|
||||
@@ -207,73 +126,45 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
else:
|
||||
raise orm.except_orm(
|
||||
_('Error:'),
|
||||
_("Payment Type Code '%s' is not supported. The only Payment Type Codes supported for SEPA Credit Transfers are 'pain.001.001.02', 'pain.001.001.03', 'pain.001.001.04' and 'pain.001.001.05'.")
|
||||
_("Payment Type Code '%s' is not supported. The only "
|
||||
"Payment Type Codes supported for SEPA Credit Transfers "
|
||||
"are 'pain.001.001.02', 'pain.001.001.03', "
|
||||
"'pain.001.001.04' and 'pain.001.001.05'.")
|
||||
% pain_flavor)
|
||||
|
||||
gen_args = {
|
||||
'bic_xml_tag': bic_xml_tag,
|
||||
'name_maxsize': name_maxsize,
|
||||
'convert_to_ascii': convert_to_ascii,
|
||||
'payment_method': 'TRF',
|
||||
'pain_flavor': pain_flavor,
|
||||
'sepa_export': sepa_export,
|
||||
'file_obj': self.pool['banking.export.sepa'],
|
||||
'pain_xsd_file':
|
||||
'account_banking_sepa_credit_transfer/data/%s.xsd'
|
||||
% pain_flavor,
|
||||
}
|
||||
|
||||
pain_ns = {
|
||||
'xsi': 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
None: 'urn:iso:std:iso:20022:tech:xsd:%s' % pain_flavor,
|
||||
}
|
||||
|
||||
root = etree.Element('Document', nsmap=pain_ns)
|
||||
pain_root = etree.SubElement(root, root_xml_tag)
|
||||
xml_root = etree.Element('Document', nsmap=pain_ns)
|
||||
pain_root = etree.SubElement(xml_root, root_xml_tag)
|
||||
pain_03_to_05 = \
|
||||
['pain.001.001.03', 'pain.001.001.04', 'pain.001.001.05']
|
||||
|
||||
my_company_name = self._prepare_field(
|
||||
cr, uid, 'Company Name',
|
||||
'sepa_export.payment_order_ids[0].mode.bank_id.partner_id.name',
|
||||
{'sepa_export': sepa_export}, name_maxsize,
|
||||
convert_to_ascii=convert_to_ascii, context=context)
|
||||
|
||||
# A. Group header
|
||||
group_header_1_0 = etree.SubElement(pain_root, 'GrpHdr')
|
||||
message_identification_1_1 = etree.SubElement(
|
||||
group_header_1_0, 'MsgId')
|
||||
message_identification_1_1.text = self._prepare_field(
|
||||
cr, uid, 'Message Identification',
|
||||
'sepa_export.payment_order_ids[0].reference',
|
||||
{'sepa_export': sepa_export}, 35,
|
||||
convert_to_ascii=convert_to_ascii, context=context)
|
||||
creation_date_time_1_2 = etree.SubElement(group_header_1_0, 'CreDtTm')
|
||||
creation_date_time_1_2.text = datetime.strftime(
|
||||
datetime.today(), '%Y-%m-%dT%H:%M:%S')
|
||||
if pain_flavor == 'pain.001.001.02':
|
||||
# batch_booking is in "Group header" with pain.001.001.02
|
||||
# and in "Payment info" in pain.001.001.03/04
|
||||
batch_booking = etree.SubElement(group_header_1_0, 'BtchBookg')
|
||||
batch_booking.text = str(sepa_export.batch_booking).lower()
|
||||
nb_of_transactions_1_6 = etree.SubElement(
|
||||
group_header_1_0, 'NbOfTxs')
|
||||
control_sum_1_7 = etree.SubElement(group_header_1_0, 'CtrlSum')
|
||||
# Grpg removed in pain.001.001.03
|
||||
if pain_flavor == 'pain.001.001.02':
|
||||
grouping = etree.SubElement(group_header_1_0, 'Grpg')
|
||||
grouping.text = 'GRPD'
|
||||
initiating_party_1_8 = etree.SubElement(group_header_1_0, 'InitgPty')
|
||||
initiating_party_name = etree.SubElement(initiating_party_1_8, 'Nm')
|
||||
initiating_party_name.text = my_company_name
|
||||
initiating_party_identifier = self.pool['res.company'].\
|
||||
_get_initiating_party_identifier(
|
||||
cr, uid, sepa_export.payment_order_ids[0].company_id.id,
|
||||
context=context)
|
||||
initiating_party_issuer = \
|
||||
sepa_export.payment_order_ids[0].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')
|
||||
iniparty_org_other = etree.SubElement(iniparty_org_id, 'Othr')
|
||||
iniparty_org_other_id = etree.SubElement(iniparty_org_other, 'Id')
|
||||
iniparty_org_other_id.text = initiating_party_identifier
|
||||
iniparty_org_other_issuer = etree.SubElement(
|
||||
iniparty_org_other, 'Issr')
|
||||
iniparty_org_other_issuer.text = initiating_party_issuer
|
||||
group_header_1_0, nb_of_transactions_1_6, control_sum_1_7 = \
|
||||
self.generate_group_header_block(
|
||||
cr, uid, pain_root, gen_args, context=context)
|
||||
|
||||
transactions_count_1_6 = 0
|
||||
total_amount = 0.0
|
||||
amount_control_sum_1_7 = 0.0
|
||||
lines_per_group = {}
|
||||
# key = (requested_exec_date, priority)
|
||||
# key = (requested_date, priority)
|
||||
# values = list of lines as object
|
||||
today = fields.date.context_today(self, cr, uid, context=context)
|
||||
for payment_order in sepa_export.payment_order_ids:
|
||||
@@ -281,91 +172,44 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
for line in payment_order.line_ids:
|
||||
priority = line.priority
|
||||
if payment_order.date_prefered == 'due':
|
||||
requested_exec_date = line.ml_maturity_date or today
|
||||
requested_date = line.ml_maturity_date or today
|
||||
elif payment_order.date_prefered == 'fixed':
|
||||
requested_exec_date = payment_order.date_scheduled or today
|
||||
requested_date = payment_order.date_scheduled or today
|
||||
else:
|
||||
requested_exec_date = today
|
||||
if (requested_exec_date, priority) in lines_per_group:
|
||||
lines_per_group[(requested_exec_date, priority)].append(line)
|
||||
requested_date = today
|
||||
key = (requested_date, priority)
|
||||
if key in lines_per_group:
|
||||
lines_per_group[key].append(line)
|
||||
else:
|
||||
lines_per_group[(requested_exec_date, priority)] = [line]
|
||||
# Write requested_exec_date on 'Payment date' of the pay line
|
||||
if requested_exec_date != line.date:
|
||||
lines_per_group[key] = [line]
|
||||
# Write requested_date on 'Payment date' of the pay line
|
||||
if requested_date != line.date:
|
||||
self.pool['payment.line'].write(
|
||||
cr, uid, line.id,
|
||||
{'date': requested_exec_date}, context=context)
|
||||
{'date': requested_date}, context=context)
|
||||
|
||||
for (requested_exec_date, priority), lines in lines_per_group.items():
|
||||
for (requested_date, priority), lines in lines_per_group.items():
|
||||
# B. Payment info
|
||||
payment_info_2_0 = etree.SubElement(pain_root, 'PmtInf')
|
||||
payment_info_identification_2_1 = etree.SubElement(
|
||||
payment_info_2_0, 'PmtInfId')
|
||||
payment_info_identification_2_1.text = self._prepare_field(
|
||||
cr, uid, 'Payment Information Identification',
|
||||
"sepa_export.payment_order_ids[0].reference + '-' + requested_exec_date.replace('-', '') + '-' + priority", {
|
||||
'sepa_export': sepa_export,
|
||||
'priority': priority,
|
||||
'requested_exec_date': requested_exec_date
|
||||
}, 35, convert_to_ascii=convert_to_ascii, context=context)
|
||||
payment_method_2_2 = etree.SubElement(payment_info_2_0, 'PmtMtd')
|
||||
payment_method_2_2.text = 'TRF'
|
||||
if pain_flavor in pain_03_to_05:
|
||||
# batch_booking is in "Group header" with pain.001.001.02
|
||||
# and in "Payment info" in pain.001.001.03/04
|
||||
batch_booking_2_3 = etree.SubElement(
|
||||
payment_info_2_0, 'BtchBookg')
|
||||
batch_booking_2_3.text = str(sepa_export.batch_booking).lower()
|
||||
# It may seem surprising, but the
|
||||
# "SEPA Credit Transfer Scheme Customer-to-bank Implementation
|
||||
# guidelines" v6.0 says that control sum and nb_of_transactions
|
||||
# should be present at both "group header" level and "payment info"
|
||||
# level. This seems to be confirmed by the tests carried out at
|
||||
# BNP Paribas in PAIN v001.001.03
|
||||
if pain_flavor in pain_03_to_05:
|
||||
nb_of_transactions_2_4 = etree.SubElement(
|
||||
payment_info_2_0, 'NbOfTxs')
|
||||
control_sum_2_5 = etree.SubElement(payment_info_2_0, 'CtrlSum')
|
||||
payment_type_info_2_6 = etree.SubElement(
|
||||
payment_info_2_0, 'PmtTpInf')
|
||||
if priority:
|
||||
instruction_priority_2_7 = etree.SubElement(
|
||||
payment_type_info_2_6, 'InstrPrty')
|
||||
instruction_priority_2_7.text = priority
|
||||
service_level_2_8 = etree.SubElement(
|
||||
payment_type_info_2_6, 'SvcLvl')
|
||||
service_level_code_2_9 = etree.SubElement(service_level_2_8, 'Cd')
|
||||
service_level_code_2_9.text = 'SEPA'
|
||||
requested_exec_date_2_17 = etree.SubElement(
|
||||
payment_info_2_0, 'ReqdExctnDt')
|
||||
requested_exec_date_2_17.text = requested_exec_date
|
||||
debtor_2_19 = etree.SubElement(payment_info_2_0, 'Dbtr')
|
||||
debtor_name = etree.SubElement(debtor_2_19, 'Nm')
|
||||
debtor_name.text = my_company_name
|
||||
debtor_account_2_20 = etree.SubElement(
|
||||
payment_info_2_0, 'DbtrAcct')
|
||||
debtor_account_id = etree.SubElement(debtor_account_2_20, 'Id')
|
||||
debtor_account_iban = etree.SubElement(debtor_account_id, 'IBAN')
|
||||
debtor_account_iban.text = self._validate_iban(
|
||||
cr, uid, self._prepare_field(
|
||||
cr, uid, 'Company IBAN',
|
||||
'sepa_export.payment_order_ids[0].mode.bank_id.acc_number',
|
||||
{'sepa_export': sepa_export},
|
||||
convert_to_ascii=convert_to_ascii, context=context),
|
||||
context=context)
|
||||
debtor_agent_2_21 = etree.SubElement(payment_info_2_0, 'DbtrAgt')
|
||||
debtor_agent_institution = etree.SubElement(
|
||||
debtor_agent_2_21, 'FinInstnId')
|
||||
debtor_agent_bic = etree.SubElement(
|
||||
debtor_agent_institution, bic_xml_tag)
|
||||
# TODO validate BIC with pattern
|
||||
# [A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}
|
||||
# because OpenERP doesn't have a constraint on BIC
|
||||
debtor_agent_bic.text = self._prepare_field(
|
||||
cr, uid, 'Company BIC',
|
||||
payment_info_2_0, nb_of_transactions_2_4, control_sum_2_5 = \
|
||||
self.generate_start_payment_info_block(
|
||||
cr, uid, pain_root,
|
||||
"sepa_export.payment_order_ids[0].reference + '-' "
|
||||
"+ requested_date.replace('-', '') + '-' + priority",
|
||||
priority, False, False, requested_date, {
|
||||
'sepa_export': sepa_export,
|
||||
'priority': priority,
|
||||
'requested_date': requested_date,
|
||||
}, gen_args, context=context)
|
||||
|
||||
self.generate_party_block(
|
||||
cr, uid, payment_info_2_0, 'Dbtr', 'B',
|
||||
'sepa_export.payment_order_ids[0].mode.bank_id.partner_id.'
|
||||
'name',
|
||||
'sepa_export.payment_order_ids[0].mode.bank_id.acc_number',
|
||||
'sepa_export.payment_order_ids[0].mode.bank_id.bank.bic',
|
||||
{'sepa_export': sepa_export},
|
||||
convert_to_ascii=convert_to_ascii, context=context)
|
||||
gen_args, context=context)
|
||||
|
||||
charge_bearer_2_24 = etree.SubElement(payment_info_2_0, 'ChrgBr')
|
||||
charge_bearer_2_24.text = sepa_export.charge_bearer
|
||||
|
||||
@@ -383,11 +227,11 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
payment_identification_2_28, 'EndToEndId')
|
||||
end2end_identification_2_30.text = self._prepare_field(
|
||||
cr, uid, 'End to End Identification', 'line.name',
|
||||
{'line': line}, 35, convert_to_ascii=convert_to_ascii,
|
||||
{'line': line}, 35, gen_args=gen_args,
|
||||
context=context)
|
||||
currency_name = self._prepare_field(
|
||||
cr, uid, 'Currency Code', 'line.currency.name',
|
||||
{'line': line}, 3, convert_to_ascii=convert_to_ascii,
|
||||
{'line': line}, 3, gen_args=gen_args,
|
||||
context=context)
|
||||
amount_2_42 = etree.SubElement(
|
||||
credit_transfer_transaction_info_2_27, 'Amt')
|
||||
@@ -396,91 +240,23 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
instructed_amount_2_43.text = '%.2f' % line.amount_currency
|
||||
amount_control_sum_1_7 += line.amount_currency
|
||||
amount_control_sum_2_5 += line.amount_currency
|
||||
creditor_agent_2_77 = etree.SubElement(
|
||||
credit_transfer_transaction_info_2_27, 'CdtrAgt')
|
||||
creditor_agent_institution = etree.SubElement(
|
||||
creditor_agent_2_77, 'FinInstnId')
|
||||
|
||||
if not line.bank_id:
|
||||
raise orm.except_orm(
|
||||
_('Error:'),
|
||||
_("Missing Bank Account on invoice '%s' (payment order line reference '%s').")
|
||||
_("Missing Bank Account on invoice '%s' (payment "
|
||||
"order line reference '%s').")
|
||||
% (line.ml_inv_ref.number, line.name))
|
||||
creditor_agent_bic = etree.SubElement(
|
||||
creditor_agent_institution, bic_xml_tag)
|
||||
creditor_agent_bic.text = self._prepare_field(
|
||||
cr, uid, 'Creditor BIC', 'line.bank_id.bank.bic',
|
||||
{'line': line}, convert_to_ascii=convert_to_ascii,
|
||||
self.generate_party_block(
|
||||
cr, uid, credit_transfer_transaction_info_2_27, 'Cdtr',
|
||||
'C', 'line.partner_id.name', 'line.bank_id.acc_number',
|
||||
'line.bank_id.bank.bic', {'line': line}, gen_args,
|
||||
context=context)
|
||||
creditor_2_79 = etree.SubElement(
|
||||
credit_transfer_transaction_info_2_27, 'Cdtr')
|
||||
creditor_name = etree.SubElement(creditor_2_79, 'Nm')
|
||||
creditor_name.text = self._prepare_field(
|
||||
cr, uid, 'Creditor Name', 'line.partner_id.name',
|
||||
{'line': line}, name_maxsize,
|
||||
convert_to_ascii=convert_to_ascii, context=context)
|
||||
creditor_account_2_80 = etree.SubElement(
|
||||
credit_transfer_transaction_info_2_27, 'CdtrAcct')
|
||||
creditor_account_id = etree.SubElement(
|
||||
creditor_account_2_80, 'Id')
|
||||
creditor_account_iban = etree.SubElement(
|
||||
creditor_account_id, 'IBAN')
|
||||
creditor_account_iban.text = self._validate_iban(
|
||||
cr, uid, self._prepare_field(
|
||||
cr, uid, 'Creditor IBAN',
|
||||
'line.bank_id.acc_number', {'line': line},
|
||||
convert_to_ascii=convert_to_ascii, context=context),
|
||||
context=context)
|
||||
remittance_info_2_91 = etree.SubElement(
|
||||
credit_transfer_transaction_info_2_27, 'RmtInf')
|
||||
if line.state == 'normal':
|
||||
remittance_info_unstructured_2_99 = etree.SubElement(
|
||||
remittance_info_2_91, 'Ustrd')
|
||||
remittance_info_unstructured_2_99.text = \
|
||||
self._prepare_field(
|
||||
cr, uid, 'Remittance Unstructured Information',
|
||||
'line.communication', {'line': line}, 140,
|
||||
convert_to_ascii=convert_to_ascii,
|
||||
context=context)
|
||||
else:
|
||||
if not line.struct_communication_type:
|
||||
raise orm.except_orm(
|
||||
_('Error:'),
|
||||
_("Missing 'Structured Communication Type' on payment line with your reference '%s'.")
|
||||
% (line.name))
|
||||
remittance_info_unstructured_2_100 = etree.SubElement(
|
||||
remittance_info_2_91, 'Strd')
|
||||
creditor_ref_information_2_120 = etree.SubElement(
|
||||
remittance_info_unstructured_2_100, 'CdtrRefInf')
|
||||
if pain_flavor in pain_03_to_05:
|
||||
creditor_ref_info_type_2_121 = etree.SubElement(
|
||||
creditor_ref_information_2_120, 'Tp')
|
||||
creditor_ref_info_type_or_2_122 = etree.SubElement(
|
||||
creditor_ref_info_type_2_121, 'CdOrPrtry')
|
||||
creditor_ref_info_type_code_2_123 = etree.SubElement(
|
||||
creditor_ref_info_type_or_2_122, 'Cd')
|
||||
creditor_ref_info_type_issuer_2_125 = etree.SubElement(
|
||||
creditor_ref_info_type_2_121, 'Issr')
|
||||
creditor_reference_2_126 = etree.SubElement(
|
||||
creditor_ref_information_2_120, 'Ref')
|
||||
else:
|
||||
creditor_ref_info_type_2_121 = etree.SubElement(
|
||||
creditor_ref_information_2_120, 'CdtrRefTp')
|
||||
creditor_ref_info_type_code_2_123 = etree.SubElement(
|
||||
creditor_ref_info_type_2_121, 'Cd')
|
||||
creditor_ref_info_type_issuer_2_125 = etree.SubElement(
|
||||
creditor_ref_info_type_2_121, 'Issr')
|
||||
creditor_reference_2_126 = etree.SubElement(
|
||||
creditor_ref_information_2_120, 'CdtrRef')
|
||||
|
||||
creditor_ref_info_type_code_2_123.text = 'SCOR'
|
||||
creditor_ref_info_type_issuer_2_125.text = \
|
||||
line.struct_communication_type
|
||||
creditor_reference_2_126.text = \
|
||||
self._prepare_field(
|
||||
cr, uid, 'Creditor Structured Reference',
|
||||
'line.communication', {'line': line}, 35,
|
||||
convert_to_ascii=convert_to_ascii,
|
||||
context=context)
|
||||
self.generate_remittance_info_block(
|
||||
cr, uid, credit_transfer_transaction_info_2_27,
|
||||
line, gen_args, context=context)
|
||||
|
||||
if pain_flavor in pain_03_to_05:
|
||||
nb_of_transactions_2_4.text = str(transactions_count_2_4)
|
||||
control_sum_2_5.text = '%.2f' % amount_control_sum_2_5
|
||||
@@ -492,41 +268,13 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
nb_of_transactions_1_6.text = str(transactions_count_1_6)
|
||||
control_sum_1_7.text = '%.2f' % amount_control_sum_1_7
|
||||
|
||||
xml_string = etree.tostring(
|
||||
root, pretty_print=True, encoding='UTF-8', xml_declaration=True)
|
||||
_logger.debug(
|
||||
"Generated SEPA Credit Transfer XML file in format %s below"
|
||||
% pain_flavor)
|
||||
_logger.debug(xml_string)
|
||||
self._validate_xml(cr, uid, xml_string, pain_flavor)
|
||||
|
||||
# CREATE the banking.export.sepa record
|
||||
file_id = self.pool.get('banking.export.sepa').create(
|
||||
cr, uid, self._prepare_export_sepa(
|
||||
cr, uid, sepa_export, total_amount, transactions_count_1_6,
|
||||
xml_string, context=context),
|
||||
context=context)
|
||||
|
||||
self.write(
|
||||
cr, uid, ids, {
|
||||
'file_id': file_id,
|
||||
'state': 'finish',
|
||||
}, context=context)
|
||||
|
||||
action = {
|
||||
'name': 'SEPA Credit Transfer File',
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': self._name,
|
||||
'res_id': ids[0],
|
||||
'target': 'new',
|
||||
}
|
||||
return action
|
||||
return self.finalize_sepa_file_creation(
|
||||
cr, uid, ids, xml_root, total_amount, transactions_count_1_6,
|
||||
gen_args, context=context)
|
||||
|
||||
def cancel_sepa(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
Cancel the SEPA PAIN: just drop the file
|
||||
Cancel the SEPA file: just drop the file
|
||||
'''
|
||||
sepa_export = self.browse(cr, uid, ids[0], context=context)
|
||||
self.pool.get('banking.export.sepa').unlink(
|
||||
@@ -535,7 +283,7 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
|
||||
def save_sepa(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
Save the SEPA PAIN: send the done signal to all payment
|
||||
Save the SEPA file: send the done signal to all payment
|
||||
orders in the file. With the default workflow, they will
|
||||
transition to 'done', while with the advanced workflow in
|
||||
account_banking_payment they will transition to 'sent' waiting
|
||||
|
||||
Reference in New Issue
Block a user