mirror of
https://github.com/brain-tec/account_ebics.git
synced 2025-08-02 16:59:20 +00:00
[13.0]account_ebics 1.3.0 - generic order type
This commit is contained in:
@@ -70,7 +70,7 @@ class EbicsFile(models.Model):
|
||||
raise UserError(_(
|
||||
"You can only remove EBICS files in state 'Draft'."))
|
||||
# execute format specific actions
|
||||
ff = ebics_file.format_id.name
|
||||
ff = ebics_file.format_id.download_process_method
|
||||
if ff in ff_methods:
|
||||
if ff_methods[ff].get('unlink'):
|
||||
ff_methods[ff]['unlink'](ebics_file)
|
||||
@@ -92,7 +92,7 @@ class EbicsFile(models.Model):
|
||||
self = self.with_context(ctx)
|
||||
self.note_process = ''
|
||||
ff_methods = self._file_format_methods()
|
||||
ff = self.format_id.name
|
||||
ff = self.format_id.download_process_method
|
||||
if ff in ff_methods:
|
||||
if ff_methods[ff].get('process'):
|
||||
res = ff_methods[ff]['process'](self)
|
||||
@@ -120,15 +120,18 @@ class EbicsFile(models.Model):
|
||||
for extra file formats.
|
||||
"""
|
||||
res = {
|
||||
'camt.xxx.cfonb120.stm':
|
||||
'cfonb120':
|
||||
{'process': self._process_cfonb120,
|
||||
'unlink': self._unlink_cfonb120},
|
||||
'camt.052.001.02.stm':
|
||||
'camt.052':
|
||||
{'process': self._process_camt052,
|
||||
'unlink': self._unlink_camt052},
|
||||
'camt.053.001.02.stm':
|
||||
'camt.053':
|
||||
{'process': self._process_camt053,
|
||||
'unlink': self._unlink_camt053},
|
||||
'camt.054':
|
||||
{'process': self._process_camt054,
|
||||
'unlink': self._unlink_camt054},
|
||||
}
|
||||
return res
|
||||
|
||||
@@ -294,6 +297,20 @@ class EbicsFile(models.Model):
|
||||
"""
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def _process_camt054(self):
|
||||
import_module = 'account_bank_statement_import_camt_oca'
|
||||
self._check_import_module(import_module)
|
||||
return self._process_camt053(self)
|
||||
|
||||
@staticmethod
|
||||
def _unlink_camt054(self):
|
||||
"""
|
||||
Placeholder for camt054 specific actions before removing the
|
||||
EBICS data file and its related bank statements.
|
||||
"""
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def _process_camt053(self):
|
||||
import_module = 'account_bank_statement_import_camt%'
|
||||
|
@@ -1,29 +1,41 @@
|
||||
# Copyright 2009-2020 Noviat.
|
||||
# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class EbicsFileFormat(models.Model):
|
||||
_name = 'ebics.file.format'
|
||||
_description = 'EBICS File Formats'
|
||||
_order = 'type,name'
|
||||
_order = 'type,name,order_type'
|
||||
|
||||
name = fields.Char(
|
||||
string='Request Type',
|
||||
required=True,
|
||||
help="E.g. camt.053.001.02.stm, camt.xxx.cfonb120.stm, "
|
||||
"pain.001.001.03.sct (check your EBICS contract).\n")
|
||||
help="E.g. camt.xxx.cfonb120.stm, pain.001.001.03.sct.\n"
|
||||
"Specify camt.052, camt.053, camt.054 for camt "
|
||||
"Order Types such as C53, Z53, C54, Z54.\n"
|
||||
"This name has to match the 'Request Type' in your "
|
||||
"EBICS contract for Order Type 'FDL' or 'FUL'.\n")
|
||||
type = fields.Selection(
|
||||
selection=[('down', 'Download'),
|
||||
('up', 'Upload')],
|
||||
required=True)
|
||||
order_type = fields.Char(
|
||||
string='Order Type',
|
||||
required=True,
|
||||
help="E.g. C53 (check your EBICS contract).\n"
|
||||
"For most banks in France you should use the "
|
||||
"format neutral Order Types 'FUL' for upload "
|
||||
"and 'FDL' for download.")
|
||||
download_process_method = fields.Selection(
|
||||
selection='_selection_download_process_method',
|
||||
help="Enable processing within Odoo of the downloaded file "
|
||||
"via the 'Process' button."
|
||||
"E.g. specify camt.053 to import a camt.053 file and create "
|
||||
"a bank statement.")
|
||||
# TODO:
|
||||
# move signature_class parameter so that it can be set per EBICS config
|
||||
signature_class = fields.Selection(
|
||||
selection=[('E', 'Single signature'),
|
||||
('T', 'Transport signature')],
|
||||
@@ -32,9 +44,19 @@ class EbicsFileFormat(models.Model):
|
||||
"ERP system when using class 'E' to prevent unauthorised "
|
||||
"users to make supplier payments."
|
||||
"\nLeave this field empty to use the default "
|
||||
"defined for your bank connection.")
|
||||
"defined for your EBICS UserID.")
|
||||
description = fields.Char()
|
||||
suffix = fields.Char(
|
||||
required=True,
|
||||
help="Specify the filename suffix for this File Format."
|
||||
"\nE.g. camt.053.xml")
|
||||
"\nE.g. c53.xml")
|
||||
|
||||
@api.model
|
||||
def _selection_download_process_method(self):
|
||||
methods = self.env['ebics.file']._file_format_methods().keys()
|
||||
return [(x, x) for x in methods]
|
||||
|
||||
@api.onchange('type')
|
||||
def _onchange_type(self):
|
||||
if self.type == 'up':
|
||||
self.download_process_method = False
|
||||
|
@@ -32,10 +32,10 @@ try:
|
||||
keycode=fintech_register_keycode,
|
||||
users=fintech_register_users)
|
||||
except RuntimeError as e:
|
||||
if e.message == "'register' can be called only once":
|
||||
if str(e) == "'register' can be called only once":
|
||||
pass
|
||||
else:
|
||||
_logger.error(e.message)
|
||||
_logger.error(str(e))
|
||||
fintech.register()
|
||||
except Exception:
|
||||
msg = "fintech.register error"
|
||||
|
Reference in New Issue
Block a user