feat(bridge_mrp): SO workflow stage + contextual buttons (CHUNK 3/4)
Sale Order form now guides the user through the next step without
making them navigate between screens.
New computed field sale.order.x_fc_workflow_stage with 12 stages:
draft → awaiting_parts → inspecting → accept_parts → assign_work
→ in_production → ready_to_ship → shipped → invoicing
→ paid → complete (+ cancelled)
Driven by SO.state + x_fc_receiving_status + MO state +
delivery.state + invoice payment state.
Five contextual header buttons (only 1-2 visible at any time,
fusion_claims pattern — invisible="x_fc_workflow_stage != 'foo'"):
Mark Inspecting → flips receiving to 'inspecting'
Accept Parts → flips receiving to 'accepted' + SO status
to 'inspected', unlocks manager assignment
Assign To Me & Release → manager claims the job, confirms all draft
MOs (which auto-generates WOs already)
Open Shop Floor → jumps to Plant Overview during production
Mark Shipped → closes open delivery records → triggers
auto-invoice per strategy
Info banner shows current stage + assigned manager on the sheet so
users always know where they are.
New fields:
sale.order.x_fc_assigned_manager_id (Many2one res.users, tracked)
mrp.production.x_fc_assigned_manager_id (Many2one, propagated on
MO confirm)
MO.action_confirm() now pulls the assigned manager from the SO (or
falls back to SO.user_id) and sets it on the MO — sets up the
Manager Dashboard (chunk 2) and role-based assignment (chunk 4) to
filter "my jobs" cleanly.
Smoke-tested across 10 demo SOs — stages compute correctly:
S00028 → ready_to_ship, S00027-25 → awaiting_parts,
S00023-20 → complete/shipped, S00029 → draft.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,62 @@
|
||||
string="Deliveries"/>
|
||||
</button>
|
||||
</xpath>
|
||||
|
||||
<!-- ===== Contextual workflow buttons on the header =====
|
||||
One (sometimes two) visible at a time. Pattern mirrors
|
||||
fusion_claims ADP handling — invisible bindings key off
|
||||
the computed x_fc_workflow_stage selector. -->
|
||||
<xpath expr="//header" position="inside">
|
||||
<field name="x_fc_workflow_stage" invisible="1"/>
|
||||
<field name="x_fc_assigned_manager_id" invisible="1"/>
|
||||
|
||||
<button name="action_fp_mark_inspected"
|
||||
string="Mark Inspecting" type="object"
|
||||
class="btn-primary" icon="fa-search"
|
||||
invisible="x_fc_workflow_stage != 'inspecting'"
|
||||
help="Move receiving record(s) into the Inspecting state."/>
|
||||
|
||||
<button name="action_fp_accept_parts"
|
||||
string="Accept Parts" type="object"
|
||||
class="btn-primary" icon="fa-check"
|
||||
invisible="x_fc_workflow_stage not in ('inspecting', 'accept_parts')"
|
||||
help="Parts pass inspection — ready for assignment."/>
|
||||
|
||||
<button name="action_fp_assign_to_me"
|
||||
string="Assign To Me & Release" type="object"
|
||||
class="btn-primary" icon="fa-user-plus"
|
||||
invisible="x_fc_workflow_stage != 'assign_work'"
|
||||
help="Take ownership as manager and release MOs to the shop floor."/>
|
||||
|
||||
<button name="action_fp_open_shop_floor"
|
||||
string="Open Shop Floor" type="object"
|
||||
class="btn-secondary" icon="fa-industry"
|
||||
invisible="x_fc_workflow_stage != 'in_production'"
|
||||
help="Jump to the Plant Overview to watch production."/>
|
||||
|
||||
<button name="action_fp_mark_shipped"
|
||||
string="Mark Shipped" type="object"
|
||||
class="btn-success" icon="fa-truck"
|
||||
invisible="x_fc_workflow_stage != 'ready_to_ship'"
|
||||
help="Close the open delivery record(s) and fire auto-invoice per strategy."/>
|
||||
</xpath>
|
||||
|
||||
<!-- Show the workflow stage on the sheet so users always
|
||||
know what step they're on (readonly banner). -->
|
||||
<xpath expr="//sheet" position="inside">
|
||||
<div class="alert alert-info mb-2"
|
||||
style="border-radius: 6px;"
|
||||
invisible="x_fc_workflow_stage in ('draft', 'complete', 'cancelled')">
|
||||
<i class="fa fa-compass me-2"/>
|
||||
<strong>Current stage:</strong>
|
||||
<field name="x_fc_workflow_stage" readonly="1" nolabel="1" class="ms-1"/>
|
||||
<span class="ms-3 text-muted"
|
||||
invisible="not x_fc_assigned_manager_id">
|
||||
· Assigned to
|
||||
<field name="x_fc_assigned_manager_id" readonly="1" nolabel="1" class="ms-1"/>
|
||||
</span>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user