mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-27 14:37:25 +00:00
[13.0]fix stack trace when bank journal not found (#16)
This commit is contained in:
parent
1cf0d1920d
commit
37406c4042
@ -165,7 +165,7 @@ class EbicsFile(models.Model):
|
|||||||
""",
|
""",
|
||||||
(tuple(st_line_ids),)
|
(tuple(st_line_ids),)
|
||||||
)
|
)
|
||||||
statement_ids = list(self.env.cr.fetchall()[0])
|
statement_ids = [x[0] for x in self.env.cr.fetchall()]
|
||||||
self.note_process += _(
|
self.note_process += _(
|
||||||
"Number of Bank Statements: %s"
|
"Number of Bank Statements: %s"
|
||||||
) % len(statement_ids)
|
) % len(statement_ids)
|
||||||
@ -224,11 +224,26 @@ class EbicsFile(models.Model):
|
|||||||
'notifications': []},
|
'notifications': []},
|
||||||
}
|
}
|
||||||
wiz_ctx = dict(self.env.context, active_model='ebics.file')
|
wiz_ctx = dict(self.env.context, active_model='ebics.file')
|
||||||
for attachment_vals in attachments_vals:
|
for i, attachment_vals in enumerate(attachments_vals, start=1):
|
||||||
wiz_vals = {'attachment_ids': [(0, 0, attachment_vals)]}
|
wiz_vals = {'attachment_ids': [(0, 0, attachment_vals)]}
|
||||||
wiz = self.env[wiz_model].with_context(wiz_ctx).create(wiz_vals)
|
wiz = self.env[wiz_model].with_context(wiz_ctx).create(wiz_vals)
|
||||||
res = wiz.import_file()
|
res = wiz.import_file()
|
||||||
ctx = res.get('context')
|
ctx = res.get('context')
|
||||||
|
if (res.get('res_model')
|
||||||
|
== 'account.bank.statement.import.journal.creation'):
|
||||||
|
message = _(
|
||||||
|
"Error detected while importing statement number %s.\n"
|
||||||
|
) % i
|
||||||
|
message += _("No financial journal found.")
|
||||||
|
details = _(
|
||||||
|
'Bank account number: %s'
|
||||||
|
) % ctx.get('default_bank_acc_number')
|
||||||
|
result['context']['notifications'].extend([{
|
||||||
|
'type': 'warning',
|
||||||
|
'message': message,
|
||||||
|
'details': details,
|
||||||
|
}])
|
||||||
|
continue
|
||||||
result['context']['statement_line_ids'].extend(
|
result['context']['statement_line_ids'].extend(
|
||||||
ctx['statement_line_ids'])
|
ctx['statement_line_ids'])
|
||||||
result['context']['notifications'].extend(
|
result['context']['notifications'].extend(
|
||||||
|
Loading…
Reference in New Issue
Block a user