diff --git a/account_bank_statement_import_online/models/online_bank_statement_provider.py b/account_bank_statement_import_online/models/online_bank_statement_provider.py index 72fa2d47..0858618d 100644 --- a/account_bank_statement_import_online/models/online_bank_statement_provider.py +++ b/account_bank_statement_import_online/models/online_bank_statement_provider.py @@ -248,6 +248,8 @@ class OnlineBankStatementProvider(models.Model): for line_values in lines_data: date = line_values['date'] if not isinstance(date, datetime): + if not isinstance(date, str): + date = fields.Datetime.to_string(date) date = fields.Datetime.from_string(date) if date.tzinfo is None: diff --git a/account_bank_statement_import_online/tests/test_account_bank_statement_import_online.py b/account_bank_statement_import_online/tests/test_account_bank_statement_import_online.py index 048da677..78d830aa 100644 --- a/account_bank_statement_import_online/tests/test_account_bank_statement_import_online.py +++ b/account_bank_statement_import_online/tests/test_account_bank_statement_import_online.py @@ -574,7 +574,7 @@ class TestAccountBankAccountStatementImportOnline(common.TransactionCase): self.assertEqual(lines[2].date, '2020-04-18') self.assertEqual(lines[3].date, '2020-04-18') - def test_timestamp_date_only(self): + def test_timestamp_date_only_date(self): journal = self.AccountJournal.create({ 'name': 'Bank', 'type': 'bank', @@ -599,13 +599,11 @@ class TestAccountBankAccountStatementImportOnline(common.TransactionCase): self.assertEqual(len(statement), 1) lines = statement.line_ids - self.assertEqual(len(lines), 4) - self.assertEqual(lines[0].date, '2020-04-18') - self.assertEqual(lines[1].date, '2020-04-18') - self.assertEqual(lines[2].date, '2020-04-18') - self.assertEqual(lines[3].date, '2020-04-18') + self.assertEqual(len(lines), 24) + for line in lines: + self.assertEqual(line.date, '2020-04-18') - def test_timestamp_date_only(self): + def test_timestamp_date_only_str(self): journal = self.AccountJournal.create({ 'name': 'Bank', 'type': 'bank',