Files
Odoo-Modules/fusion_plating/fusion_plating_certificates/views/fp_certificate_views.xml
gsinghpal 6658544f85 feat(fusion_plating): Tier 2 (quality + audit) and Tier 3 (business) features
Tier 2 — Quality & audit readiness:

- T2.1 SPC on thickness readings (fp.certificate)
  - spec_min_mils / spec_max_mils auto-pulled from coating config on create
  - Computed: std_dev_mils, min/max, cpk, cpk_status (incapable/marginal/
    capable/excellent/insufficient)
  - Western Electric trend rules (rule 1: any point beyond 3σ; rule 4:
    8 consecutive on one side of mean) → trend_alert + explanation
  - New SPC group on certificate form with badge-coloured indicators

- T2.2 Operator certification enforcement (fp.operator.certification)
  - Per (employee, process_type) records with issued/expires dates,
    training record attachment, revocation workflow
  - State auto-computed: active → expired when date passes
  - MrpWorkorder.button_start() blocks with UserError if current user's
    linked hr.employee lacks an active cert for the bath's process_type
  - Managers bypass the check; expiring-soon filter in search view
  - HR Employee form: "Plating Certifications" tab

- T2.3 Material traceability chain
  - fusion.plating.batch.workorder_id (new Many2one) + production_id
    (related through WO) for full chain
  - fp.certificate gets computed batch_ids / bath_ids / batch_count
  - "Batches" stat button → list of batches used for this cert's MO,
    with their chemistry logs intact

- T2.4 Pre-treatment as first-class baths
  - process_family selection on fusion.plating.process.type
    (pre_treatment / plating / post_treatment / bake / strip / passivation /
    masking / inspection)
  - Bath search view: Pre-Treatments / Plating / Post-Treatments / Strip
    quick filters
  - Existing bath infra (logs, replenishment, SPC) now applies to pre-
    treatment baths equally

Tier 3 — Business / revenue:

- T3.1 Customer-specific price lists (fp.customer.price.list)
  - Per (customer, coating_config) with unit_price + basis (per_part /
    sqin / sqft / lb)
  - effective_from / effective_to for annual contract pricing
  - min_quantity for volume breaks (cheapest price at requested qty wins)
  - _find_price() helper resolves active entry by date + qty
  - Direct Order wizard auto-fills unit_price on (partner, coating, qty)
    change unless operator has typed an override
  - Configurator menu → Customer Price Lists

- T3.2 Quote win/loss tracking (fp.quote.configurator)
  - State values: draft → confirmed (won) / lost / expired / cancelled
  - lost_reason selection (price / lead_time / tech / spec_mismatch /
    no_bid / no_response / competitor / other) + lost_competitor_name
    + lost_details text
  - Action buttons: Mark as Lost (requires reason), Mark as Expired
  - won_date auto-set on SO creation; lost_date auto-set on mark_lost
  - New "Win / Loss" tab on configurator form

- T3.3 Actuals vs. quoted margin (mrp.production)
  - Computed monetary fields: x_fc_consumables_cost, x_fc_labour_cost,
    x_fc_actual_cost, x_fc_quoted_revenue, x_fc_margin_actual,
    x_fc_margin_pct
  - Labour = sum(WO duration × workcentre cost_hour)
  - Revenue = SO amount_untaxed via mo.origin lookup
  - New "Job Costing" group on MO form with badge-coloured margin

- T3.4 Job consumables tracking (fp.job.consumption)
  - One row per consumable event (bath replenisher, masking tape, PPE,
    chemistry): product, qty, uom, unit_cost (snapshot), total_cost,
    source, optional workorder link
  - One2many x_fc_consumption_ids on mrp.production
  - "Consumables" stat button on MO → filtered list

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-16 23:55:22 -04:00

230 lines
11 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- ============================================================ -->
<!-- LIST VIEW -->
<!-- ============================================================ -->
<record id="fp_certificate_view_list" model="ir.ui.view">
<field name="name">fp.certificate.list</field>
<field name="model">fp.certificate</field>
<field name="arch" type="xml">
<list default_order="issue_date desc"
decoration-muted="state == 'draft'"
decoration-success="state == 'issued'"
decoration-danger="state == 'voided'">
<field name="issue_date"/>
<field name="name"/>
<field name="certificate_type" widget="badge"/>
<field name="partner_id"/>
<field name="part_number"/>
<field name="po_number"/>
<field name="entech_wo_number"/>
<field name="process_description"/>
<field name="quantity_shipped"/>
<field name="issued_by_id"/>
<field name="state" widget="badge"
decoration-info="state == 'draft'"
decoration-success="state == 'issued'"
decoration-danger="state == 'voided'"/>
</list>
</field>
</record>
<!-- ============================================================ -->
<!-- FORM VIEW -->
<!-- ============================================================ -->
<record id="fp_certificate_view_form" model="ir.ui.view">
<field name="name">fp.certificate.form</field>
<field name="model">fp.certificate</field>
<field name="arch" type="xml">
<form>
<header>
<button name="action_issue" string="Issue"
type="object" class="btn-primary"
invisible="state != 'draft'"/>
<button name="action_void" string="Void"
type="object" class="btn-danger"
invisible="state != 'issued'"/>
<button name="action_send_to_customer" string="Send to Customer"
type="object"
invisible="state != 'issued'"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,issued"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_view_traceability"
type="object"
class="oe_stat_button"
icon="fa-sitemap"
invisible="batch_count == 0">
<field name="batch_count" widget="statinfo"
string="Batches"/>
</button>
</div>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<group>
<group>
<field name="certificate_type"/>
<field name="partner_id"/>
<field name="sale_order_id"/>
<field name="production_id"/>
<field name="portal_job_id"/>
<field name="issue_date"/>
</group>
<group>
<field name="part_number"/>
<field name="po_number"/>
<field name="entech_wo_number"/>
<field name="process_description"/>
<field name="spec_reference"/>
<field name="quantity_shipped"/>
</group>
</group>
<group>
<group>
<field name="issued_by_id"/>
<field name="certified_by_id"/>
</group>
<group>
<field name="reading_count" readonly="1"/>
<field name="mean_nip_mils" readonly="1"/>
</group>
</group>
<group string="SPC — Statistical Process Control">
<group>
<field name="spec_min_mils"/>
<field name="spec_max_mils"/>
<field name="min_reading_mils" readonly="1"/>
<field name="max_reading_mils" readonly="1"/>
<field name="std_dev_mils" readonly="1"/>
</group>
<group>
<field name="cpk" readonly="1"/>
<field name="cpk_status" readonly="1" widget="badge"
decoration-success="cpk_status in ('capable','excellent')"
decoration-warning="cpk_status == 'marginal'"
decoration-danger="cpk_status == 'incapable'"
decoration-muted="cpk_status == 'insufficient'"/>
<field name="trend_alert" readonly="1" widget="badge"
decoration-success="trend_alert == 'ok'"
decoration-warning="trend_alert == 'warning'"
decoration-danger="trend_alert == 'alert'"/>
<field name="trend_explanation" readonly="1"
invisible="trend_alert == 'ok'"/>
</group>
</group>
<notebook>
<page string="Thickness Readings" name="readings">
<field name="thickness_reading_ids">
<list editable="bottom">
<field name="reading_number"/>
<field name="nip_mils"/>
<field name="ni_percent"/>
<field name="p_percent"/>
<field name="position_label"/>
<field name="equipment_model"/>
<field name="operator_id"/>
<field name="reading_datetime"/>
</list>
</field>
</page>
<page string="Certificate PDF" name="pdf">
<group>
<field name="attachment_id"/>
</group>
</page>
<page string="Void" name="void"
invisible="state != 'voided'">
<group>
<field name="void_reason"/>
</group>
</page>
<page string="Notes" name="notes">
<field name="notes"/>
</page>
</notebook>
</sheet>
<chatter>
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</chatter>
</form>
</field>
</record>
<!-- ============================================================ -->
<!-- SEARCH VIEW -->
<!-- ============================================================ -->
<record id="fp_certificate_view_search" model="ir.ui.view">
<field name="name">fp.certificate.search</field>
<field name="model">fp.certificate</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="partner_id"/>
<field name="part_number"/>
<field name="po_number"/>
<field name="entech_wo_number"/>
<separator/>
<filter name="filter_coc" string="CoC"
domain="[('certificate_type', '=', 'coc')]"/>
<filter name="filter_thickness" string="Thickness Report"
domain="[('certificate_type', '=', 'thickness_report')]"/>
<filter name="filter_mill_test" string="Mill Test"
domain="[('certificate_type', '=', 'mill_test')]"/>
<filter name="filter_nadcap" string="Nadcap"
domain="[('certificate_type', '=', 'nadcap_cert')]"/>
<separator/>
<filter name="filter_draft" string="Draft"
domain="[('state', '=', 'draft')]"/>
<filter name="filter_issued" string="Issued"
domain="[('state', '=', 'issued')]"/>
<filter name="filter_voided" string="Voided"
domain="[('state', '=', 'voided')]"/>
<separator/>
<filter name="filter_this_week" string="This Week"
domain="[('issue_date', '>=', (context_today() - relativedelta(weeks=1)).strftime('%Y-%m-%d'))]"/>
<filter name="filter_this_month" string="This Month"
domain="[('issue_date', '>=', context_today().strftime('%Y-%m-01'))]"/>
<separator/>
<group>
<filter name="group_customer" string="Customer"
context="{'group_by': 'partner_id'}"/>
<filter name="group_type" string="Type"
context="{'group_by': 'certificate_type'}"/>
<filter name="group_issued_by" string="Issued By"
context="{'group_by': 'issued_by_id'}"/>
<filter name="group_month" string="Month"
context="{'group_by': 'issue_date:month'}"/>
</group>
</search>
</field>
</record>
<!-- ============================================================ -->
<!-- WINDOW ACTION -->
<!-- ============================================================ -->
<record id="action_fp_certificate" model="ir.actions.act_window">
<field name="name">Certificates</field>
<field name="res_model">fp.certificate</field>
<field name="view_mode">list,form</field>
<field name="search_view_id" ref="fp_certificate_view_search"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create your first certificate
</p>
<p>
Certificates of Conformance, thickness reports, and other quality
documents are tracked here.
</p>
</field>
</record>
</odoo>