From 5c82d8ed949c2e938670ff0af26ea3fc6531bd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Thu, 31 Aug 2023 00:19:35 +0200 Subject: [PATCH] account_ebics_oca_statement_import - check type of date --- account_ebics_oca_statement_import/__manifest__.py | 2 +- .../wizards/account_statement_import.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/account_ebics_oca_statement_import/__manifest__.py b/account_ebics_oca_statement_import/__manifest__.py index dbcc95f..afbca14 100644 --- a/account_ebics_oca_statement_import/__manifest__.py +++ b/account_ebics_oca_statement_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "account_ebics with OCA Bank Statement Imoort", "summary": "Use OCA Bank Statement Import with account_ebics", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "author": "Noviat", "website": "https://www.noviat.com/", "category": "Hidden", diff --git a/account_ebics_oca_statement_import/wizards/account_statement_import.py b/account_ebics_oca_statement_import/wizards/account_statement_import.py index 09dcded..819cd02 100644 --- a/account_ebics_oca_statement_import/wizards/account_statement_import.py +++ b/account_ebics_oca_statement_import/wizards/account_statement_import.py @@ -2,6 +2,7 @@ # License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). import logging +from datetime import date, datetime from odoo import _, models @@ -31,7 +32,7 @@ class AccountStatementImport(models.TransientModel): + ":\n" + message ) - _logger.warn(log_msg) + _logger.warning(log_msg) return return super()._check_parsed_data(stmts_vals) @@ -57,12 +58,18 @@ class AccountStatementImport(models.TransientModel): if result["statement_ids"] == statement_ids: # no statement has been created, this is the case # 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( _( "Statement %(st_name)s dated %(date)s " "has already been imported.", st_name=st_vals["name"], - date=st_vals["date"].strftime("%Y-%m-%d"), + date=st_date, ) )