This commit is contained in:
gsinghpal
2026-04-20 01:16:12 -04:00
parent 8217bb0ff6
commit 54e56ed0e6
39 changed files with 5600 additions and 1131 deletions

View File

@@ -125,3 +125,42 @@ class FpPortalJob(models.Model):
def _progress_percent(self):
self.ensure_one()
return self._state_progress_map().get(self.state, 0)
# ------------------------------------------------------------------
# Customer-visible process steps
#
# Walks the linked production's recipe tree and returns only the
# nodes the recipe author marked `customer_visible=True`. Used by
# the portal job page so internal QC / setup / handling steps stay
# hidden from the customer while the substantive process steps are
# surfaced.
# ------------------------------------------------------------------
def get_customer_visible_steps(self):
"""Return [{'name': str, 'icon': str, 'depth': int}] for portal display."""
self.ensure_one()
Production = self.env.get('mrp.production')
if Production is None:
return []
mo = Production.sudo().search(
[('x_fc_portal_job_id', '=', self.id)], limit=1,
)
if not mo or not mo.x_fc_recipe_id:
return []
result = []
def walk(node, depth):
for child in node.child_ids.sorted('sequence'):
if not child.customer_visible:
# Hidden node — and its sub-tree is also hidden,
# because if you're skipping the parent the kids
# never make sense in isolation.
continue
result.append({
'name': child.name,
'icon': child.icon or 'fa-cog',
'depth': depth,
'node_type': child.node_type,
})
walk(child, depth + 1)
walk(mo.x_fc_recipe_id, 0)
return result

View File

@@ -588,6 +588,21 @@
</div>
</div>
<!-- Process Steps — only the customer-visible recipe nodes
(recipe author marked customer_visible=True). -->
<t t-set="visible_steps" t-value="job.sudo().get_customer_visible_steps()"/>
<div class="mb-4" t-if="visible_steps">
<h6 class="text-muted small text-uppercase">Process Steps</h6>
<ol class="list-group list-group-numbered">
<li t-foreach="visible_steps" t-as="step"
class="list-group-item d-flex align-items-center"
t-attf-style="padding-left: #{ 12 + (step['depth'] * 18) }px;">
<i t-attf-class="fa #{ step['icon'] } me-2 text-muted"/>
<span t-out="step['name']"/>
</li>
</ol>
</div>
<div class="mb-4">
<h6 class="text-muted small text-uppercase">Documents</h6>
<div class="list-group">