fix(process-tree): breadcrumb pile-up + dead "No MO selected" banner

Two issues on the Process Tree client action:

1. Back to Work Order kept growing breadcrumbs (WO -> Tree -> WO ->
   Tree -> ...) because onBack used action.doAction() which PUSHES
   a new act_window onto the stack instead of popping. Fixed by
   trying action.restore() first (pops the Tree off the stack and
   returns to the parent WO/Step controller). Falls through to
   explicit doAction only when there's no parent in the stack
   (direct URL access).

2. The empty-state banner referenced productionId, a dead variable
   from the bridge_mrp era when the tree was tied to mrp.production.
   Since the component now uses jobId (fp.job context key), the
   "No manufacturing order selected" message ALWAYS fired regardless
   of whether a job was loaded. Fixed by using jobId and updating
   the message to "No work order selected".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-12 09:05:27 -04:00
parent 2d9779047b
commit 01a46e33e2
3 changed files with 18 additions and 5 deletions

View File

@@ -5,7 +5,7 @@
{ {
'name': 'Fusion Plating — Shop Floor', 'name': 'Fusion Plating — Shop Floor',
'version': '19.0.25.2.0', 'version': '19.0.25.2.1',
'category': 'Manufacturing/Plating', 'category': 'Manufacturing/Plating',
'summary': 'Shop-floor tablet stations, QR scanning, bake window enforcer, ' 'summary': 'Shop-floor tablet stations, QR scanning, bake window enforcer, '
'first-piece inspection gates.', 'first-piece inspection gates.',

View File

@@ -131,6 +131,19 @@ export class ProcessTree extends Component {
} }
onBack() { onBack() {
// Try action.restore() first — that pops the Process Tree
// off the breadcrumb stack and returns the user to the WO
// (or Step) they came from. Without this, doAction pushes a
// NEW act_window each time and the breadcrumb keeps growing
// (WO → Tree → WO → Tree → ...).
try {
this.action.restore();
return;
} catch (e) {
// No parent in the stack (user opened Process Tree by
// URL or as the first action). Fall through to explicit
// navigation.
}
const stepId = this.backStepId; const stepId = this.backStepId;
if (stepId) { if (stepId) {
this.action.doAction({ this.action.doAction({

View File

@@ -119,14 +119,14 @@
<!-- ========== EMPTY ========== --> <!-- ========== EMPTY ========== -->
<div class="o_fp_pt_empty" <div class="o_fp_pt_empty"
t-if="!state.loading and !productionId"> t-if="!state.loading and !jobId">
<i class="fa fa-exclamation-triangle"/> <i class="fa fa-exclamation-triangle"/>
<div>No manufacturing order selected.</div> <div>No work order selected.</div>
</div> </div>
<div class="o_fp_pt_empty" <div class="o_fp_pt_empty"
t-if="!state.loading and productionId and !state.root"> t-if="!state.loading and jobId and !state.root">
<i class="fa fa-sitemap"/> <i class="fa fa-sitemap"/>
<div>No process steps for this order.</div> <div>No process steps for this work order.</div>
</div> </div>
<!-- ========== TREE ========== --> <!-- ========== TREE ========== -->