feat(fusion_accounting_followup): inherit account.move.line for level tracking

Made-with: Cursor
This commit is contained in:
gsinghpal
2026-04-19 20:47:37 -04:00
parent 2ddc600d65
commit 06dafc31c1
5 changed files with 51 additions and 1 deletions

View File

@@ -7,3 +7,4 @@ from . import test_fusion_followup_level
from . import test_fusion_followup_run
from . import test_fusion_followup_text_cache
from . import test_res_partner_inherit
from . import test_account_move_line_inherit

View File

@@ -0,0 +1,34 @@
from odoo import fields as odoo_fields
from odoo.tests.common import TransactionCase
from odoo.tests import tagged
@tagged('post_install', '-at_install')
class TestAccountMoveLineFollowup(TransactionCase):
"""Verify follow-up tracking fields are added to account.move.line."""
def test_fields_exist_on_model(self):
"""Both new fields are declared on account.move.line."""
AML = self.env['account.move.line']
self.assertIn('fusion_followup_level_id', AML._fields)
self.assertIn('fusion_followup_last_run_date', AML._fields)
self.assertEqual(
AML._fields['fusion_followup_level_id'].comodel_name,
'fusion.followup.level',
)
def test_assign_level_and_date_on_existing_line(self):
"""We can write the new fields onto an existing move line."""
line = self.env['account.move.line'].search([], limit=1)
if not line:
self.skipTest("No account.move.line records present in DB to test against.")
level = self.env['fusion.followup.level'].create({
'name': 'Reminder', 'sequence': 601, 'delay_days': 7, 'tone': 'gentle',
})
when = odoo_fields.Datetime.now()
line.write({
'fusion_followup_level_id': level.id,
'fusion_followup_last_run_date': when,
})
self.assertEqual(line.fusion_followup_level_id, level)
self.assertEqual(line.fusion_followup_last_run_date, when)