feat(fusion_accounting_followup): batch send follow-ups wizard
Made-with: Cursor
This commit is contained in:
@@ -17,3 +17,4 @@ from . import test_followup_cron
|
||||
from . import test_engine_property
|
||||
from . import test_followup_full_flow
|
||||
from . import test_performance_benchmarks
|
||||
from . import test_batch_followup_wizard
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.tests import tagged
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestBatchFollowupWizard(TransactionCase):
|
||||
|
||||
def test_default_loads_active_ids(self):
|
||||
partners = self.env['res.partner'].create([
|
||||
{'name': 'B1'}, {'name': 'B2'},
|
||||
])
|
||||
wizard = self.env['fusion.batch.followup.wizard'].with_context(
|
||||
active_model='res.partner', active_ids=partners.ids,
|
||||
).create({})
|
||||
self.assertEqual(set(wizard.partner_ids.ids), set(partners.ids))
|
||||
|
||||
def test_selected_scope_no_partners_raises(self):
|
||||
wizard = self.env['fusion.batch.followup.wizard'].create({
|
||||
'scope': 'selected', 'partner_ids': [(6, 0, [])],
|
||||
})
|
||||
with self.assertRaises(UserError):
|
||||
wizard.action_run()
|
||||
|
||||
def test_run_completes_with_no_overdue_partners(self):
|
||||
partners = self.env['res.partner'].create([
|
||||
{'name': 'NoOverdue1'}, {'name': 'NoOverdue2'},
|
||||
])
|
||||
wizard = self.env['fusion.batch.followup.wizard'].create({
|
||||
'scope': 'selected',
|
||||
'partner_ids': [(6, 0, partners.ids)],
|
||||
'force': True,
|
||||
})
|
||||
wizard.action_run()
|
||||
self.assertEqual(wizard.state, 'done')
|
||||
# 2 partners with no overdue → both skipped
|
||||
self.assertEqual(wizard.skipped_count, 2)
|
||||
Reference in New Issue
Block a user