feat(fusion_accounting_ai): add BankRecAdapter for tri-mode bank-rec lookups
Made-with: Cursor
This commit is contained in:
@@ -2,6 +2,7 @@ from odoo.tests.common import TransactionCase, tagged
|
||||
from odoo.addons.fusion_accounting_ai.services.data_adapters.base import (
|
||||
DataAdapter, AdapterMode,
|
||||
)
|
||||
from odoo.addons.fusion_accounting_ai.services.data_adapters import get_adapter
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
@@ -25,3 +26,35 @@ class TestDataAdapterBase(TransactionCase):
|
||||
enterprise_module='also_does_not_exist',
|
||||
)
|
||||
self.assertEqual(mode, AdapterMode.COMMUNITY)
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestBankRecAdapter(TransactionCase):
|
||||
"""Verify the bank-rec adapter returns rows in any install profile."""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.journal = self.env['account.journal'].create({
|
||||
'name': 'Test Bank',
|
||||
'type': 'bank',
|
||||
'code': 'TBNK',
|
||||
})
|
||||
self.statement = self.env['account.bank.statement'].create({
|
||||
'name': 'Test Statement',
|
||||
'journal_id': self.journal.id,
|
||||
})
|
||||
self.line = self.env['account.bank.statement.line'].create({
|
||||
'statement_id': self.statement.id,
|
||||
'journal_id': self.journal.id,
|
||||
'date': '2026-04-18',
|
||||
'payment_ref': 'Test Payment',
|
||||
'amount': 100.0,
|
||||
})
|
||||
|
||||
def test_list_unreconciled_returns_our_test_line(self):
|
||||
"""The adapter should find the unreconciled line we just created."""
|
||||
adapter = get_adapter(self.env, 'bank_rec')
|
||||
rows = adapter.list_unreconciled(journal_id=self.journal.id, limit=10)
|
||||
ids = [r['id'] for r in rows]
|
||||
self.assertIn(self.line.id, ids,
|
||||
f"Expected line {self.line.id} in unreconciled list, got: {ids}")
|
||||
|
||||
Reference in New Issue
Block a user