feat(fusion_accounting_followup): inherit account.move.line for level tracking
Made-with: Cursor
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user