fix(fusion_accounting_followup): seeded levels + migration idempotency

- test_create_minimal/negative_delay used sequence=1, which now collides
  with the seeded Friendly Reminder level. Use sequences 901/902.
- migration backfill: search by name (not raw seq) for idempotency,
  allocate sequence as max(existing)+1 to avoid both seed clashes and
  within-batch collisions when Enterprise has duplicate sequence values.

Made-with: Cursor
This commit is contained in:
gsinghpal
2026-04-19 21:33:26 -04:00
parent d0a912b1da
commit 8eb4b8dc6c
2 changed files with 25 additions and 17 deletions

View File

@@ -6,8 +6,9 @@ from odoo.tests import tagged
class TestFusionFollowupLevel(TransactionCase):
def test_create_minimal(self):
# Note: sequences 1-3 are reserved for seeded default levels.
level = self.env['fusion.followup.level'].create({
'name': 'Reminder', 'sequence': 1, 'delay_days': 7, 'tone': 'gentle',
'name': 'Reminder', 'sequence': 901, 'delay_days': 7, 'tone': 'gentle',
})
self.assertEqual(level.name, 'Reminder')
self.assertTrue(level.active)
@@ -15,7 +16,7 @@ class TestFusionFollowupLevel(TransactionCase):
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',
'name': 'Bad', 'sequence': 902, 'delay_days': -5, 'tone': 'gentle',
})
def test_duplicate_sequence_rejected(self):