35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
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)
|