feat(plating): Sub 8 — split receiving vs inspection + box parity

fp.receiving simplifies to box-count-only (new primary state
machine: draft → counted → staged → closed). Legacy
inspecting/accepted/discrepancy/resolved states stay in the
Selection so existing records load without error but are surfaced
behind a manager-only toggle. New box_count_in field + banner
that tells the receiver "count boxes only — parts are inspected
by the racking crew."

New fp.racking.inspection + fp.racking.inspection.line models —
one record per MO, auto-created by mrp.production.create() with
one line per contributing SO line (qty_expected seeded, qty_found
+ condition filled in by the racking crew when they open the boxes).
State: draft → inspecting → done | discrepancy_flagged (flagged
when any line has a non-ok condition or qty variance). Reopen
restricted to Plating Manager.

WO soft gate: first plating WO button_start raises a UserError
when the MO's racking inspection is still Draft or Inspecting.
Plating Manager bypasses; later WOs are not gated.

fp.delivery gains x_fc_box_count_out. action_mark_delivered calls
_fp_check_box_parity which posts a non-blocking chatter warning
when boxes out ≠ boxes in (resolved via job_ref → MO.origin → SO
→ receiving). Warning only — never blocks shipping.

Menu entry: Plating → Operations → Racking Inspection.

Module version bumps:
  fusion_plating_receiving  → 19.0.3.0.0
  fusion_plating_logistics  → 19.0.3.0.0
  fusion_plating_bridge_mrp → 19.0.12.0.0 (+depends receiving)

Smoke on entech: 12/12 assertions pass (one gate test skipped —
MO had no WOs to test) including box-count state machine, inspection
auto-create, lifecycle, discrepancy flag, and box-parity chatter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-23 00:30:36 -04:00
parent 392359d2c4
commit 2bfabfe135
15 changed files with 808 additions and 25 deletions

View File

@@ -40,28 +40,50 @@
<field name="arch" type="xml">
<form string="Receiving">
<header>
<button name="action_start_inspection"
string="Start Inspection"
type="object"
invisible="state != 'draft'"/>
<button name="action_accept"
string="Accept"
<!-- Sub 8 — new primary flow: box count only -->
<button name="action_mark_counted"
string="Mark Counted"
type="object"
class="btn-primary"
invisible="state not in ('inspecting', 'resolved')"/>
invisible="state not in ('draft', 'inspecting')"/>
<button name="action_mark_staged"
string="Stage for Racking"
type="object"
class="btn-primary"
invisible="state != 'counted'"/>
<button name="action_close"
string="Close"
type="object"
invisible="state not in ('staged', 'accepted', 'resolved')"/>
<!-- Legacy actions (hidden by default; surfaces for old records) -->
<button name="action_accept"
string="Accept (legacy)"
type="object"
invisible="state != 'inspecting'"
groups="fusion_plating.group_fusion_plating_manager"/>
<button name="action_flag_discrepancy"
string="Flag Discrepancy"
string="Flag Discrepancy (legacy)"
type="object"
class="btn-danger"
invisible="state != 'inspecting'"/>
invisible="state != 'inspecting'"
groups="fusion_plating.group_fusion_plating_manager"/>
<button name="action_resolve"
string="Resolve"
string="Resolve (legacy)"
type="object"
invisible="state != 'discrepancy'"/>
invisible="state != 'discrepancy'"
groups="fusion_plating.group_fusion_plating_manager"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,inspecting,accepted"/>
statusbar_visible="draft,counted,staged,closed"/>
</header>
<sheet>
<div class="alert alert-info" role="alert">
<i class="fa fa-info-circle me-2"/>
<strong>Receiving = box count only.</strong>
Count the boxes the truck dropped off, set the number
below, and stage them for racking. The racking crew
opens the boxes and inspects each part — see
<em>Plating → Operations → Racking Inspection</em>.
</div>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
@@ -73,6 +95,9 @@
<field name="partner_id"/>
<field name="po_number"/>
</group>
<group string="Box Count">
<field name="box_count_in"/>
</group>
</group>
<group>
<group string="Reception">
@@ -81,9 +106,9 @@
<field name="carrier_name"/>
<field name="carrier_tracking"/>
</group>
<group string="Quantities">
<field name="expected_qty"/>
<field name="received_qty"/>
<group string="Quantities (populated by racking crew)">
<field name="expected_qty" readonly="1"/>
<field name="received_qty" readonly="1"/>
<field name="qty_match" widget="boolean_toggle" readonly="1"/>
</group>
</group>