feat(fusion_accounting_followup): inherit account.move.line for level tracking
Made-with: Cursor
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
'name': 'Fusion Accounting Follow-up',
|
'name': 'Fusion Accounting Follow-up',
|
||||||
'version': '19.0.1.0.9',
|
'version': '19.0.1.0.10',
|
||||||
'category': 'Accounting/Accounting',
|
'category': 'Accounting/Accounting',
|
||||||
'summary': 'AI-augmented customer follow-ups (dunning) for unpaid invoices.',
|
'summary': 'AI-augmented customer follow-ups (dunning) for unpaid invoices.',
|
||||||
'description': """
|
'description': """
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ from . import fusion_followup_level
|
|||||||
from . import fusion_followup_run
|
from . import fusion_followup_run
|
||||||
from . import fusion_followup_text_cache
|
from . import fusion_followup_text_cache
|
||||||
from . import res_partner
|
from . import res_partner
|
||||||
|
from . import account_move_line
|
||||||
|
|||||||
14
fusion_accounting_followup/models/account_move_line.py
Normal file
14
fusion_accounting_followup/models/account_move_line.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
"""Inherit account.move.line: track last follow-up level."""
|
||||||
|
|
||||||
|
from odoo import _, api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class AccountMoveLine(models.Model):
|
||||||
|
_inherit = "account.move.line"
|
||||||
|
|
||||||
|
fusion_followup_level_id = fields.Many2one(
|
||||||
|
'fusion.followup.level', copy=False,
|
||||||
|
help="Last follow-up level at which this line was contacted.")
|
||||||
|
fusion_followup_last_run_date = fields.Datetime(
|
||||||
|
copy=False,
|
||||||
|
help="When the line was most-recently included in a follow-up.")
|
||||||
@@ -7,3 +7,4 @@ from . import test_fusion_followup_level
|
|||||||
from . import test_fusion_followup_run
|
from . import test_fusion_followup_run
|
||||||
from . import test_fusion_followup_text_cache
|
from . import test_fusion_followup_text_cache
|
||||||
from . import test_res_partner_inherit
|
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