Merge pull request #40 from Noviat/14-fix-stack-trace

[14.0]account_ebics - fix stack trace when using Odoo OE statement im…
This commit is contained in:
Luc De Meyer 2022-08-05 12:32:28 +02:00 committed by GitHub
commit b0b5ca9e57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 36 deletions

View File

@ -3,7 +3,7 @@
{
"name": "EBICS banking protocol",
"version": "14.0.1.0.3",
"version": "14.0.1.0.4",
"license": "LGPL-3",
"author": "Noviat",
"website": "www.noviat.com",

View File

@ -168,10 +168,12 @@ class EbicsFile(models.Model):
return False
return True
def _process_result_action(self, res):
def _process_result_action(self, res, parser="oca"):
notifications = []
st_line_ids = []
statement_ids = []
sts_data = []
if parser == "oca":
if res.get("context"):
notifications = res["context"].get("notifications", [])
st_line_ids = res["context"].get("statement_line_ids", [])
@ -204,8 +206,21 @@ class EbicsFile(models.Model):
(tuple(st_line_ids),),
)
sts_data = self.env.cr.dictfetchall()
elif parser == "oe":
if res.get("res_id"):
st_ids = res["res_id"]
else:
sts_data = []
st_ids = res["domain"][2]
statements = self.env["account.bank.statement"].browse(st_ids)
for statement in statements:
sts_data.append(
{
"statement_id": statement.id,
"date": statement.date,
"name": statement.name,
"company_name": statement.company_id.name,
}
)
st_cnt = len(sts_data)
if st_cnt:
self.note_process += _("%s bank statements have been imported: ") % st_cnt
@ -414,7 +429,7 @@ class EbicsFile(models.Model):
_("No financial journal found for Company Bank Account %s")
% bank_account
)
return self._process_result_action(res)
return self._process_result_action(res, parser="oe")
@staticmethod
def _unlink_camt053(self):