From aab842d6d39f31bd5982eeba02099b37b09b965f Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Tue, 26 May 2026 21:21:23 -0400 Subject: [PATCH] feat(configurator): D1+D2 - drafts dual-routing + legacy deprecation banner D1: action_open_draft method routes drafts-list click to the matching form view by view_source. view_source badge column added to the drafts list (Express=blue, Legacy=muted). D2: Deprecation banner on the legacy direct-order form pointing operators to the new Express view, plus a Switch-to-Express header button. Legacy action context defaults new drafts to view_source='legacy' (Express action defaults to 'express') so newly-created drafts open in the right view automatically. --- .../wizard/fp_direct_order_wizard.py | 22 ++++++++++++ .../wizard/fp_direct_order_wizard_views.xml | 36 +++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/fusion_plating/fusion_plating_configurator/wizard/fp_direct_order_wizard.py b/fusion_plating/fusion_plating_configurator/wizard/fp_direct_order_wizard.py index b1e68727..999ef32c 100644 --- a/fusion_plating/fusion_plating_configurator/wizard/fp_direct_order_wizard.py +++ b/fusion_plating/fusion_plating_configurator/wizard/fp_direct_order_wizard.py @@ -193,6 +193,28 @@ class FpDirectOrderWizard(models.Model): ).id, 'target': 'current', } + + def action_open_draft(self): + """Route the drafts-list row-click to the form view matching view_source. + + Drafts created in the Express view re-open in Express; drafts + created in the Legacy view re-open in Legacy. Either view's + header has a 'Switch to ...' button to bounce between. + """ + self.ensure_one() + view_xmlid = ( + 'fusion_plating_configurator.view_fp_express_order_form' + if self.view_source == 'express' + else 'fusion_plating_configurator.view_fp_direct_order_wizard_form' + ) + return { + 'type': 'ir.actions.act_window', + 'res_model': 'fp.direct.order.wizard', + 'res_id': self.id, + 'view_mode': 'form', + 'view_id': self.env.ref(view_xmlid).id, + 'target': 'current', + } invoice_strategy = fields.Selection( [('deposit', 'Deposit'), ('progress', 'Progress Billing'), ('net_terms', 'Net Terms'), ('cod_prepay', 'COD / Prepay')], diff --git a/fusion_plating/fusion_plating_configurator/wizard/fp_direct_order_wizard_views.xml b/fusion_plating/fusion_plating_configurator/wizard/fp_direct_order_wizard_views.xml index 042bbef7..7128aa0b 100644 --- a/fusion_plating/fusion_plating_configurator/wizard/fp_direct_order_wizard_views.xml +++ b/fusion_plating/fusion_plating_configurator/wizard/fp_direct_order_wizard_views.xml @@ -24,7 +24,21 @@ invisible="state != 'cancelled'"/> +