feat(fusion_accounting_ai): 5 new customer follow-up AI tools
Adds Task 17 tool layer: - fusion_list_overdue - fusion_get_partner_followup_detail - fusion_generate_followup_text - fusion_send_followup - fusion_get_partner_risk_score Tools register through TOOL_DISPATCH and degrade with a clear error message when fusion_accounting_followup is not installed. 5 TransactionCase tests added (78 total). Made-with: Cursor
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
'name': 'Fusion Accounting Follow-up',
|
||||
'version': '19.0.1.0.16',
|
||||
'version': '19.0.1.0.17',
|
||||
'category': 'Accounting/Accounting',
|
||||
'summary': 'AI-augmented customer follow-ups (dunning) for unpaid invoices.',
|
||||
'description': """
|
||||
|
||||
@@ -12,3 +12,4 @@ from . import test_fusion_followup_engine
|
||||
from . import test_engine_integration
|
||||
from . import test_followup_controller
|
||||
from . import test_followup_adapter
|
||||
from . import test_followup_tools
|
||||
|
||||
61
fusion_accounting_followup/tests/test_followup_tools.py
Normal file
61
fusion_accounting_followup/tests/test_followup_tools.py
Normal file
@@ -0,0 +1,61 @@
|
||||
"""AI tool dispatch tests for fusion follow-up tools."""
|
||||
|
||||
from odoo.tests import tagged
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
from odoo.addons.fusion_accounting_ai.services.tools import customer_followup as tools
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestFusionFollowupTools(TransactionCase):
|
||||
|
||||
def test_fusion_list_overdue(self):
|
||||
result = tools.fusion_list_overdue(
|
||||
self.env, {'company_id': self.env.company.id},
|
||||
)
|
||||
self.assertIn('partners', result)
|
||||
|
||||
def test_fusion_get_partner_detail(self):
|
||||
partner = self.env['res.partner'].create({
|
||||
'name': 'Tool Partner', 'email': 't@t.local',
|
||||
})
|
||||
result = tools.fusion_get_partner_followup_detail(
|
||||
self.env, {'partner_id': partner.id},
|
||||
)
|
||||
self.assertEqual(result['partner_id'], partner.id)
|
||||
|
||||
def test_fusion_generate_text_uses_fallback(self):
|
||||
self.env['ir.config_parameter'].sudo().search([
|
||||
('key', 'in', [
|
||||
'fusion_accounting.provider.followup_text',
|
||||
'fusion_accounting.provider.default',
|
||||
]),
|
||||
]).unlink()
|
||||
result = tools.fusion_generate_followup_text(self.env, {
|
||||
'partner_name': 'Acme', 'total_overdue': 1000,
|
||||
'currency_code': 'USD', 'longest_overdue_days': 15,
|
||||
'tone': 'gentle',
|
||||
})
|
||||
self.assertIn('subject', result)
|
||||
self.assertIn('body', result)
|
||||
|
||||
def test_fusion_get_risk_score(self):
|
||||
partner = self.env['res.partner'].create({'name': 'Risk Test'})
|
||||
result = tools.fusion_get_partner_risk_score(
|
||||
self.env, {'partner_id': partner.id},
|
||||
)
|
||||
self.assertIn('risk', result)
|
||||
|
||||
def test_tools_registered_in_dispatch(self):
|
||||
from odoo.addons.fusion_accounting_ai.services.tools import TOOL_DISPATCH
|
||||
for tool_name in [
|
||||
'fusion_list_overdue',
|
||||
'fusion_get_partner_followup_detail',
|
||||
'fusion_generate_followup_text',
|
||||
'fusion_send_followup',
|
||||
'fusion_get_partner_risk_score',
|
||||
]:
|
||||
self.assertIn(
|
||||
tool_name, TOOL_DISPATCH,
|
||||
f"{tool_name} not registered in TOOL_DISPATCH",
|
||||
)
|
||||
Reference in New Issue
Block a user