Skip to content

Commit

Permalink
ebics improved camt processing error message
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-demeyer committed May 24, 2018
1 parent b5e8422 commit eeba5b8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
13 changes: 7 additions & 6 deletions account_ebics/models/ebics_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@
import os
from sys import exc_info
from urllib.error import URLError

from odoo import api, fields, models, _
from odoo.exceptions import UserError

_logger = logging.getLogger(__name__)

try:
import fintech
from fintech.ebics import EbicsKeyRing, EbicsBank, EbicsUser,\
EbicsClient, EbicsFunctionalError, EbicsTechnicalError
fintech.cryptolib = 'cryptography'
except ImportError:
EbicsBank = object
logging.error('Failed to import fintech')

from odoo import api, fields, models, _
from odoo.exceptions import UserError

_logger = logging.getLogger(__name__)
_logger.warning('Failed to import fintech')


class EbicsBank(EbicsBank):
Expand Down
12 changes: 11 additions & 1 deletion account_ebics/models/ebics_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,19 @@ def _process_camt053(self):
import_module = 'account_bank_statement_import_camt'
self._check_import_module(import_module)
wiz_model = 'account.bank.statement.import'
wiz_vals = {'data_file': self.data}
wiz_vals = {
'data_file': self.data,
'filename': self.name,
}
wiz = self.env[wiz_model].create(wiz_vals)
res = wiz.import_file()
if res.get('res_model') \
== 'account.bank.statement.import.journal.creation':
if res.get('context'):
bank_account = res['context'].get('default_bank_acc_number')
raise UserError(_(
"No financial journal found for Company Bank Account %s"
) % bank_account)
notifications = []
statement_ids = []
if res.get('context'):
Expand Down
2 changes: 1 addition & 1 deletion account_ebics/models/ebics_file_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ def _selection_name(self):
'pain.008',
]
selection = [(x, x) for x in request_types]
return selection
return selection
11 changes: 6 additions & 5 deletions account_ebics/models/fintech_ebics_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging
try:
import fintech
except ImportError:
fintech = None
logging.error('Failed to import fintech')
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')
Expand Down

0 comments on commit eeba5b8

Please sign in to comment.