mirror of
https://github.com/brain-tec/account_ebics.git
synced 2025-08-14 06:35:36 +00:00
add ebics module
This commit is contained in:
40
account_ebics/models/fintech_ebics_register.py
Normal file
40
account_ebics/models/fintech_ebics_register.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright 2009-2018 Noviat.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import logging
|
||||
from sys import exc_info
|
||||
from traceback import format_exception
|
||||
|
||||
from odoo.tools import config
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
import fintech
|
||||
except ImportError:
|
||||
fintech = None
|
||||
_logger.warning('Failed to import fintech')
|
||||
|
||||
fintech_register_name = config.get('fintech_register_name')
|
||||
fintech_register_keycode = config.get('fintech_register_keycode')
|
||||
fintech_register_users = config.get('fintech_register_users')
|
||||
|
||||
try:
|
||||
if fintech:
|
||||
fintech.cryptolib = 'cryptography'
|
||||
fintech.register(
|
||||
fintech_register_name,
|
||||
fintech_register_keycode,
|
||||
fintech_register_users)
|
||||
except RuntimeError as e:
|
||||
if e.message == "'register' can be called only once":
|
||||
pass
|
||||
else:
|
||||
_logger.error(e.message)
|
||||
fintech.register()
|
||||
except:
|
||||
msg = "fintech.register error"
|
||||
tb = ''.join(format_exception(*exc_info()))
|
||||
msg += '\n%s' % tb
|
||||
_logger.error(msg)
|
||||
fintech.register()
|
Reference in New Issue
Block a user