- Switch FUSION_MODEL to fusion.followup.engine so adapter mode selection matches the new module - Add list_overdue() with fusion/enterprise/community variants - Re-route send_followup_via_fusion to engine.send_followup_email - 4 new TransactionCase tests (73 total) Existing aging / overdue_invoices adapter methods continue to fall back to the community implementation. Made-with: Cursor
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
"""FollowupAdapter wiring tests — engine paths."""
|
|
|
|
from odoo.tests import tagged
|
|
from odoo.tests.common import TransactionCase
|
|
|
|
from odoo.addons.fusion_accounting_ai.services.data_adapters.followup import (
|
|
FollowupAdapter,
|
|
)
|
|
|
|
|
|
@tagged('post_install', '-at_install')
|
|
class TestFollowupAdapter(TransactionCase):
|
|
|
|
def setUp(self):
|
|
super().setUp()
|
|
self.adapter = FollowupAdapter(self.env)
|
|
|
|
def test_list_overdue_via_fusion_returns_dict(self):
|
|
result = self.adapter.list_overdue_via_fusion(
|
|
company_id=self.env.company.id,
|
|
)
|
|
self.assertIn('partners', result)
|
|
self.assertIn('total', result)
|
|
self.assertIn('count', result)
|
|
|
|
def test_list_overdue_via_community_returns_error(self):
|
|
result = self.adapter.list_overdue_via_community()
|
|
self.assertIn('error', result)
|
|
|
|
def test_send_followup_via_fusion_no_overdue(self):
|
|
partner = self.env['res.partner'].create({'name': 'AdapterTest'})
|
|
result = self.adapter.send_followup_via_fusion(
|
|
partner_id=partner.id, force=True,
|
|
)
|
|
self.assertIn(
|
|
result.get('status', ''),
|
|
('no_action', 'no_overdue', 'sent', 'manual_review'),
|
|
)
|
|
|
|
def test_send_followup_via_community_returns_error(self):
|
|
result = self.adapter.send_followup_via_community(partner_id=1)
|
|
self.assertIn('error', result)
|