From 778c62562271dfe0038c51631dfb0061f1b5db57 Mon Sep 17 00:00:00 2001 From: Daniel Lo Nigro Date: Sun, 17 May 2026 15:09:44 -0700 Subject: [PATCH] [account_statement_import_online_plaid] Exclude pending transactions --- .../models/online_bank_statement_provider_plaid.py | 1 + .../tests/test_account_statement_import_online_plaid.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py b/account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py index ee5cf8c765..6b97605cda 100644 --- a/account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py +++ b/account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py @@ -128,4 +128,5 @@ def _prepare_vals_for_statement(self, transactions): "raw_data": transaction, } for transaction in transactions + if not transaction.get("pending") ] diff --git a/account_statement_import_online_plaid/tests/test_account_statement_import_online_plaid.py b/account_statement_import_online_plaid/tests/test_account_statement_import_online_plaid.py index 17c33eaf58..d787fb29c5 100644 --- a/account_statement_import_online_plaid/tests/test_account_statement_import_online_plaid.py +++ b/account_statement_import_online_plaid/tests/test_account_statement_import_online_plaid.py @@ -1,6 +1,7 @@ # Copyright 2024 Binhex - Adasat Torres de León. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import datetime +from copy import deepcopy from unittest.mock import MagicMock, patch from odoo.tests import common @@ -189,6 +190,13 @@ def test_import_online_bank_statement_plaid(self, trasactions_get): self.assertEqual(lines[0].amount, -500.0) self.assertEqual(lines[1].amount, -30.0) + def test_prepare_vals_for_statement_skips_pending_transactions(self): + transactions = deepcopy(TRANSACTIONS) + transactions[0]["pending"] = True + vals = self.provider._prepare_vals_for_statement(transactions) + self.assertEqual(len(vals), 1) + self.assertEqual(vals[0]["unique_import_id"], transactions[1]["transaction_id"]) + def test_get_services(self): services = self.provider._get_available_services() self.assertTrue(services)