account_ebics_oca_statement_import - check type of date

This commit is contained in:
Jérémy Didderen 2023-08-31 00:19:35 +02:00 committed by Luc De Meyer
parent 01073ab0e4
commit 5c82d8ed94
2 changed files with 10 additions and 3 deletions

View File

@ -4,7 +4,7 @@
{ {
"name": "account_ebics with OCA Bank Statement Imoort", "name": "account_ebics with OCA Bank Statement Imoort",
"summary": "Use OCA Bank Statement Import with account_ebics", "summary": "Use OCA Bank Statement Import with account_ebics",
"version": "16.0.1.0.0", "version": "16.0.1.0.1",
"author": "Noviat", "author": "Noviat",
"website": "https://www.noviat.com/", "website": "https://www.noviat.com/",
"category": "Hidden", "category": "Hidden",

View File

@ -2,6 +2,7 @@
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
import logging import logging
from datetime import date, datetime
from odoo import _, models from odoo import _, models
@ -31,7 +32,7 @@ class AccountStatementImport(models.TransientModel):
+ ":\n" + ":\n"
+ message + message
) )
_logger.warn(log_msg) _logger.warning(log_msg)
return return
return super()._check_parsed_data(stmts_vals) return super()._check_parsed_data(stmts_vals)
@ -57,12 +58,18 @@ class AccountStatementImport(models.TransientModel):
if result["statement_ids"] == statement_ids: if result["statement_ids"] == statement_ids:
# no statement has been created, this is the case # no statement has been created, this is the case
# when all transactions have been imported already # when all transactions have been imported already
if isinstance(st_vals["date"], date) or isinstance(
st_vals["date"], datetime
):
st_date = st_vals["date"].strftime("%Y-%m-%d")
else:
st_date = st_vals["date"]
messages.append( messages.append(
_( _(
"Statement %(st_name)s dated %(date)s " "Statement %(st_name)s dated %(date)s "
"has already been imported.", "has already been imported.",
st_name=st_vals["name"], st_name=st_vals["name"],
date=st_vals["date"].strftime("%Y-%m-%d"), date=st_date,
) )
) )