mirror of
https://github.com/brain-tec/account_ebics.git
synced 2026-11-06 10:00:39 +00:00
[FIX] account_ebics - Report errors of EBICS administrative orders
The note was not initialised, so a failed client setup raised a TypeError on note += ...; and functional errors were not caught, showing a raw traceback. Initialise the note and report EbicsFunctionalError like EbicsTechnicalError.
This commit is contained in:
1 parent
8147d3fa9c
commit
b0e1b053e9
1 file changed
+10
-1
@@ -9,7 +9,7 @@ from odoo import api, fields, models
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
from fintech.ebics import EbicsTechnicalError
|
||||
from fintech.ebics import EbicsFunctionalError, EbicsTechnicalError
|
||||
except ImportError:
|
||||
_logger.warning("Failed to import fintech")
|
||||
|
||||
@@ -35,6 +35,7 @@ class EbicsAdminOrder(models.TransientModel):
|
||||
|
||||
def ebics_admin_order(self):
|
||||
self.ensure_one()
|
||||
self.note = ""
|
||||
client = self._setup_client()
|
||||
if not client:
|
||||
self.note += self.env._(
|
||||
@@ -46,6 +47,14 @@ class EbicsAdminOrder(models.TransientModel):
|
||||
data = getattr(client, self.admin_order_type)(parsed=True)
|
||||
pp = pprint.PrettyPrinter()
|
||||
self.note = pp.pformat(data)
|
||||
except EbicsFunctionalError as e:
|
||||
self.note = "\n"
|
||||
self.note += self.env._(
|
||||
"EBICS Functional Error during execution of order %(order_type)s:",
|
||||
order_type=self.admin_order_type,
|
||||
)
|
||||
self.note += "\n"
|
||||
self.note += f"{e.message} (code: {e.code})"
|
||||
except EbicsTechnicalError as e:
|
||||
self.note = "\n"
|
||||
self.note += self.env._(
|
||||
|
||||
Reference in new issue
Block a user