Merge pull request #9 from Noviat/12-c52-support

[12.0][IMP] add camt52 support
This commit is contained in:
Luc De Meyer 2019-12-18 21:25:44 +01:00 committed by GitHub
commit d57fd59b5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 4 deletions

View File

@ -3,7 +3,7 @@
{ {
'name': 'EBICS banking protocol', 'name': 'EBICS banking protocol',
'version': '12.0.1.0.0', 'version': '12.0.1.0.1',
'license': 'LGPL-3', 'license': 'LGPL-3',
'author': 'Noviat', 'author': 'Noviat',
'category': 'Accounting & Finance', 'category': 'Accounting & Finance',

View File

@ -14,6 +14,18 @@
<field name="suffix">c53.xml</field> <field name="suffix">c53.xml</field>
</record> </record>
<!--
File format tested with the following banks:
- Kreissparkasse Göppingen (Germany)
-->
<record id="ebics_ff_camt_052_001_02_stm" model="ebics.file.format">
<field name="name">camt.052.001.02.stm</field>
<field name="type">down</field>
<field name="order_type">C52</field>
<field name="description">Bank Statement in Format camt.052</field>
<field name="suffix">c52.xml</field>
</record>
<!-- <!--
File format tested with the following banks: File format tested with the following banks:
- GLS Gemeinschaftsbank (Germany) - GLS Gemeinschaftsbank (Germany)
@ -41,7 +53,7 @@
<field name="description">Sepa Direct Debit (B2B) Order in Format pain.008.001.02</field> <field name="description">Sepa Direct Debit (B2B) Order in Format pain.008.001.02</field>
<field name="suffix">xml</field> <field name="suffix">xml</field>
</record> </record>
<!-- <!--
File format tested with the following banks: File format tested with the following banks:
- Credit Suisse (Switzerland) - Credit Suisse (Switzerland)

View File

@ -128,6 +128,9 @@ class EbicsFile(models.Model):
'camt.xxx.cfonb120.stm': 'camt.xxx.cfonb120.stm':
{'process': self._process_cfonb120, {'process': self._process_cfonb120,
'unlink': self._unlink_cfonb120}, 'unlink': self._unlink_cfonb120},
'camt.052.001.02.stm':
{'process': self._process_camt052,
'unlink': self._unlink_camt052},
'camt.053.001.02.stm': 'camt.053.001.02.stm':
{'process': self._process_camt053, {'process': self._process_camt053,
'unlink': self._unlink_camt053}, 'unlink': self._unlink_camt053},
@ -205,6 +208,20 @@ class EbicsFile(models.Model):
""" """
pass pass
@staticmethod
def _process_camt052(self):
import_module = 'account_bank_statement_import_camt_oca'
self._check_import_module(import_module)
return self._process_camt053(self)
@staticmethod
def _unlink_camt052(self):
"""
Placeholder for camt052 specific actions before removing the
EBICS data file and its related bank statements.
"""
pass
@staticmethod @staticmethod
def _process_camt053(self): def _process_camt053(self):
import_module = 'account_bank_statement_import_camt%' import_module = 'account_bank_statement_import_camt%'

View File

@ -48,7 +48,7 @@ class EbicsFileFormat(models.Model):
return ['FUL', 'CCT', 'CDD', 'CDB', 'XE2', 'XE3'] return ['FUL', 'CCT', 'CDD', 'CDB', 'XE2', 'XE3']
def _supported_download_order_types(self): def _supported_download_order_types(self):
return ['FDL', 'C53'] return ['FDL', 'C52', 'C53']
@api.model @api.model
def _selection_name(self): def _selection_name(self):
@ -65,6 +65,7 @@ class EbicsFileFormat(models.Model):
the doc folder of this module (EBICS_Annex2). the doc folder of this module (EBICS_Annex2).
""" """
request_types = [ request_types = [
'camt.052.001.02.stm',
'camt.053.001.02.stm', 'camt.053.001.02.stm',
'pain.001.001.03.sct', 'pain.001.001.03.sct',
'pain.008.001.02.sdd', 'pain.008.001.02.sdd',

View File

@ -165,7 +165,7 @@ class EbicsXfer(models.TransientModel):
params = {} params = {}
if order_type == 'FDL': if order_type == 'FDL':
params['filetype'] = df.name params['filetype'] = df.name
if order_type in ['FDL', 'C53']: if order_type in ['FDL', 'C52', 'C53']:
params.update({ params.update({
'start': 'start':
self.date_from and self.date_from.isoformat() self.date_from and self.date_from.isoformat()
@ -399,6 +399,7 @@ class EbicsXfer(models.TransientModel):
""" """
res = { res = {
'camt.xxx.cfonb120.stm': self._handle_cfonb120, 'camt.xxx.cfonb120.stm': self._handle_cfonb120,
'camt.052.001.02.stm': self._handle_camt052,
'camt.053.001.02.stm': self._handle_camt053, 'camt.053.001.02.stm': self._handle_camt053,
} }
return res return res
@ -535,6 +536,15 @@ class EbicsXfer(models.TransientModel):
def _handle_cfonb240(self, data_in): def _handle_cfonb240(self, data_in):
return self._insert_line_terminator(data_in, 240) return self._insert_line_terminator(data_in, 240)
def _handle_camt052(self, data_in):
"""
Use this method if you need to fix camt files received
from your bank before passing them to the
Odoo Community CAMT parser.
Remark: Odoo Enterprise doesn't support camt.052.
"""
return data_in
def _handle_camt053(self, data_in): def _handle_camt053(self, data_in):
""" """
Use this method if you need to fix camt files received Use this method if you need to fix camt files received