feat(fusion_accounting_followup): fusion.followup.level definition model

Made-with: Cursor
This commit is contained in:
gsinghpal
2026-04-19 20:43:51 -04:00
parent 1829f0584f
commit 9ae9161892
6 changed files with 89 additions and 1 deletions

View File

@@ -3,3 +3,4 @@ from . import test_level_resolver
from . import test_risk_scorer
from . import test_tone_selector
from . import test_followup_text_generator
from . import test_fusion_followup_level

View File

@@ -0,0 +1,42 @@
from odoo.tests.common import TransactionCase
from odoo.tests import tagged
@tagged('post_install', '-at_install')
class TestFusionFollowupLevel(TransactionCase):
def test_create_minimal(self):
level = self.env['fusion.followup.level'].create({
'name': 'Reminder', 'sequence': 1, 'delay_days': 7, 'tone': 'gentle',
})
self.assertEqual(level.name, 'Reminder')
self.assertTrue(level.active)
def test_negative_delay_rejected(self):
with self.assertRaises(Exception):
self.env['fusion.followup.level'].create({
'name': 'Bad', 'sequence': 1, 'delay_days': -5, 'tone': 'gentle',
})
def test_duplicate_sequence_rejected(self):
self.env['fusion.followup.level'].create({
'name': 'A', 'sequence': 100, 'delay_days': 7, 'tone': 'gentle',
})
with self.assertRaises(Exception):
self.env['fusion.followup.level'].create({
'name': 'B', 'sequence': 100, 'delay_days': 30, 'tone': 'firm',
})
def test_three_levels_escalate(self):
for seq, name, days, tone in [(1, 'R', 7, 'gentle'),
(2, 'W', 30, 'firm'),
(3, 'L', 60, 'legal')]:
self.env['fusion.followup.level'].create({
'name': name, 'sequence': seq + 200,
'delay_days': days, 'tone': tone,
})
levels = self.env['fusion.followup.level'].search([
('sequence', '>', 200),
], order='sequence')
self.assertEqual(len(levels), 3)
self.assertEqual(levels.mapped('tone'), ['gentle', 'firm', 'legal'])