Migrates Enterprise account_followup per-partner state to Fusion fields: - res.partner.followup_status -> fusion_followup_status (action_due/no_action) - res.partner.payment_next_action_date -> fusion_followup_paused_until (when future-dated; sets status to 'paused') - res.partner.followup_line_id -> fusion_followup_last_level_id (resolved by name match against migrated levels) Wired into fusion.migration.wizard.action_run_migration after the existing _followup_bootstrap_step. Idempotent: skips partners whose Fusion state is already non-default. Defensive against missing Enterprise fields (each field probed individually before use). Closes the per-partner state migration gap that was blocking Enterprise account_followup uninstall. Made-with: Cursor
31 lines
1.4 KiB
Python
31 lines
1.4 KiB
Python
from odoo.tests.common import TransactionCase
|
|
from odoo.tests import tagged
|
|
|
|
|
|
@tagged('post_install', '-at_install')
|
|
class TestFollowupMigrationRoundTrip(TransactionCase):
|
|
|
|
def test_bootstrap_step_runs(self):
|
|
wizard = self.env['fusion.migration.wizard'].create({})
|
|
result = wizard._followup_bootstrap_step()
|
|
self.assertEqual(result['step'], 'followup_bootstrap')
|
|
# Either Enterprise present or not — both OK
|
|
self.assertIn(result['enterprise_module_present'], [True, False])
|
|
|
|
def test_bootstrap_idempotent(self):
|
|
wizard = self.env['fusion.migration.wizard'].create({})
|
|
first = wizard._followup_bootstrap_step()
|
|
second = wizard._followup_bootstrap_step()
|
|
# Second run skips what first created (or both no-op)
|
|
if first['enterprise_module_present']:
|
|
self.assertGreaterEqual(second['skipped'], first['created'])
|
|
|
|
def test_partner_state_bootstrap_step(self):
|
|
"""Verify the partner-state migration step runs without error."""
|
|
wizard = self.env['fusion.migration.wizard'].create({})
|
|
result = wizard._followup_partner_state_bootstrap_step()
|
|
self.assertEqual(result['step'], 'followup_partner_state')
|
|
self.assertIn(result['enterprise_module_present'], [True, False])
|
|
self.assertGreaterEqual(result['updated'], 0)
|
|
self.assertGreaterEqual(result['skipped'], 0)
|