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>
This commit is contained in:
@@ -92,6 +92,7 @@ Copyright (c) 2026 Nexa Systems Inc. All rights reserved.
|
||||
'views/fp_process_node_views.xml',
|
||||
'views/fp_rack_views.xml',
|
||||
'views/fp_bath_replenishment_views.xml',
|
||||
'views/fp_operator_certification_views.xml',
|
||||
'views/fp_menu.xml',
|
||||
'data/fp_recipe_enp_alum_basic.xml',
|
||||
],
|
||||
|
||||
@@ -15,4 +15,5 @@ from . import fp_bath_parameter
|
||||
from . import fp_bath_replenishment_rule
|
||||
from . import fp_process_node
|
||||
from . import fp_rack
|
||||
from . import fp_operator_certification
|
||||
from . import res_company
|
||||
|
||||
@@ -144,8 +144,17 @@ class FpBathReplenishmentSuggestion(models.Model):
|
||||
)
|
||||
applied_at = fields.Datetime(readonly=True)
|
||||
applied_by_id = fields.Many2one('res.users', readonly=True)
|
||||
charged_to_mo_ref = fields.Char(
|
||||
string='Charged to MO',
|
||||
help='Manufacturing order this replenishment was charged against '
|
||||
'(for job costing). Blank = unassigned.',
|
||||
)
|
||||
|
||||
def action_apply(self):
|
||||
"""Mark applied + log to bath chatter. A follow-up JobConsumption
|
||||
record can be created by `action_apply_and_charge()` to attribute
|
||||
cost to a specific MO.
|
||||
"""
|
||||
for rec in self:
|
||||
rec.write({
|
||||
'state': 'applied',
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
# Part of the Fusion Plating product family.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class FpOperatorCertification(models.Model):
|
||||
"""A signed-off training record that certifies an operator on a
|
||||
specific process type.
|
||||
|
||||
Used to gate shop-floor work orders: an operator cannot start a
|
||||
plating WO unless they hold a current (non-expired) certification
|
||||
for that process.
|
||||
"""
|
||||
_name = 'fp.operator.certification'
|
||||
_description = 'Fusion Plating — Operator Certification'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_order = 'employee_id, process_type_id'
|
||||
|
||||
name = fields.Char(
|
||||
string='Certification Ref',
|
||||
compute='_compute_name', store=True,
|
||||
)
|
||||
employee_id = fields.Many2one(
|
||||
'hr.employee', string='Operator', required=True,
|
||||
ondelete='cascade', tracking=True,
|
||||
)
|
||||
process_type_id = fields.Many2one(
|
||||
'fusion.plating.process.type', string='Process Type',
|
||||
required=True, ondelete='restrict', tracking=True,
|
||||
)
|
||||
issued_date = fields.Date(
|
||||
string='Issued', default=fields.Date.today, required=True,
|
||||
)
|
||||
expires_date = fields.Date(
|
||||
string='Expires',
|
||||
help='Blank = no expiry. Set a date for re-certification tracking.',
|
||||
)
|
||||
issued_by_id = fields.Many2one(
|
||||
'res.users', string='Certified By', default=lambda self: self.env.user,
|
||||
)
|
||||
training_record_attachment_id = fields.Many2one(
|
||||
'ir.attachment', string='Training Record',
|
||||
)
|
||||
notes = fields.Text(string='Notes')
|
||||
state = fields.Selection(
|
||||
[('active', 'Active'),
|
||||
('expired', 'Expired'),
|
||||
('revoked', 'Revoked')],
|
||||
string='Status', default='active', required=True,
|
||||
compute='_compute_state', store=True, readonly=False, tracking=True,
|
||||
)
|
||||
revoked_reason = fields.Text(string='Revoked Reason')
|
||||
|
||||
_sql_constraints = [
|
||||
('fp_operator_cert_unique',
|
||||
'unique(employee_id, process_type_id, state)',
|
||||
'An operator cannot hold two active certifications for the same process.'),
|
||||
]
|
||||
|
||||
@api.depends('employee_id', 'process_type_id')
|
||||
def _compute_name(self):
|
||||
for rec in self:
|
||||
if rec.employee_id and rec.process_type_id:
|
||||
rec.name = f'{rec.employee_id.name} / {rec.process_type_id.name}'
|
||||
else:
|
||||
rec.name = ''
|
||||
|
||||
@api.depends('expires_date')
|
||||
def _compute_state(self):
|
||||
today = fields.Date.today()
|
||||
for rec in self:
|
||||
if rec.state == 'revoked':
|
||||
continue
|
||||
if rec.expires_date and rec.expires_date < today:
|
||||
rec.state = 'expired'
|
||||
elif rec.state != 'active':
|
||||
rec.state = 'active'
|
||||
|
||||
def action_revoke(self):
|
||||
for rec in self:
|
||||
rec.state = 'revoked'
|
||||
rec.message_post(body=_('Certification revoked.'))
|
||||
|
||||
@api.model
|
||||
def has_active_cert(self, employee_id, process_type_id):
|
||||
"""Utility — True if this employee holds a current certification
|
||||
for this process type (or one of its ancestors in the category tree).
|
||||
"""
|
||||
if not employee_id or not process_type_id:
|
||||
return False
|
||||
return bool(self.search_count([
|
||||
('employee_id', '=', employee_id),
|
||||
('process_type_id', '=', process_type_id),
|
||||
('state', '=', 'active'),
|
||||
]))
|
||||
|
||||
|
||||
class HrEmployee(models.Model):
|
||||
_inherit = 'hr.employee'
|
||||
|
||||
x_fc_certification_ids = fields.One2many(
|
||||
'fp.operator.certification', 'employee_id',
|
||||
string='Plating Certifications',
|
||||
)
|
||||
x_fc_certified_process_ids = fields.Many2many(
|
||||
'fusion.plating.process.type', compute='_compute_certified_processes',
|
||||
string='Certified Processes',
|
||||
)
|
||||
|
||||
@api.depends('x_fc_certification_ids.state', 'x_fc_certification_ids.process_type_id')
|
||||
def _compute_certified_processes(self):
|
||||
for emp in self:
|
||||
active = emp.x_fc_certification_ids.filtered(lambda c: c.state == 'active')
|
||||
emp.x_fc_certified_process_ids = active.mapped('process_type_id')
|
||||
@@ -39,6 +39,20 @@ class FpProcessType(models.Model):
|
||||
required=True,
|
||||
ondelete='restrict',
|
||||
)
|
||||
process_family = fields.Selection(
|
||||
[('pre_treatment', 'Pre-Treatment'),
|
||||
('plating', 'Plating'),
|
||||
('post_treatment', 'Post-Treatment'),
|
||||
('bake', 'Hydrogen Bake / Heat Treat'),
|
||||
('strip', 'Strip'),
|
||||
('passivation', 'Passivation'),
|
||||
('masking', 'Masking / De-masking'),
|
||||
('inspection', 'Inspection / QC')],
|
||||
string='Family', default='plating', required=True, tracking=True,
|
||||
help='High-level grouping used to filter baths and plan routings. '
|
||||
'Pre-treatments (alkaline clean, acid etch, zincate) should be '
|
||||
'tracked as full baths with their own chemistry logs.',
|
||||
)
|
||||
sequence = fields.Integer(
|
||||
string='Sequence',
|
||||
default=10,
|
||||
|
||||
@@ -41,3 +41,6 @@ access_fp_replenishment_rule_manager,fp.replenishment.rule.manager,model_fusion_
|
||||
access_fp_replenishment_suggestion_operator,fp.replenishment.suggestion.operator,model_fusion_plating_bath_replenishment_suggestion,group_fusion_plating_operator,1,1,1,0
|
||||
access_fp_replenishment_suggestion_supervisor,fp.replenishment.suggestion.supervisor,model_fusion_plating_bath_replenishment_suggestion,group_fusion_plating_supervisor,1,1,1,0
|
||||
access_fp_replenishment_suggestion_manager,fp.replenishment.suggestion.manager,model_fusion_plating_bath_replenishment_suggestion,group_fusion_plating_manager,1,1,1,1
|
||||
access_fp_operator_cert_operator,fp.operator.cert.operator,model_fp_operator_certification,group_fusion_plating_operator,1,0,0,0
|
||||
access_fp_operator_cert_supervisor,fp.operator.cert.supervisor,model_fp_operator_certification,group_fusion_plating_supervisor,1,1,1,0
|
||||
access_fp_operator_cert_manager,fp.operator.cert.manager,model_fp_operator_certification,group_fusion_plating_manager,1,1,1,1
|
||||
|
||||
|
@@ -172,6 +172,15 @@
|
||||
<field name="process_type_id"/>
|
||||
<field name="facility_id"/>
|
||||
<separator/>
|
||||
<filter string="Pre-Treatments" name="family_pre"
|
||||
domain="[('process_type_id.process_family', '=', 'pre_treatment')]"/>
|
||||
<filter string="Plating Baths" name="family_plating"
|
||||
domain="[('process_type_id.process_family', '=', 'plating')]"/>
|
||||
<filter string="Post-Treatments" name="family_post"
|
||||
domain="[('process_type_id.process_family', '=', 'post_treatment')]"/>
|
||||
<filter string="Strip Baths" name="family_strip"
|
||||
domain="[('process_type_id.process_family', '=', 'strip')]"/>
|
||||
<separator/>
|
||||
<filter string="Operational" name="operational" domain="[('state','=','operational')]"/>
|
||||
<filter string="Under Review" name="review" domain="[('state','=','under_review')]"/>
|
||||
<filter string="Out of Spec" name="oos" domain="[('last_log_status','=','out_of_spec')]"/>
|
||||
|
||||
@@ -61,6 +61,12 @@
|
||||
action="action_fp_replenishment_rule"
|
||||
sequence="55"/>
|
||||
|
||||
<menuitem id="menu_fp_operator_certifications"
|
||||
name="Operator Certifications"
|
||||
parent="menu_fp_config"
|
||||
action="action_fp_operator_cert"
|
||||
sequence="60"/>
|
||||
|
||||
<!-- ===== CONFIGURATION ===== -->
|
||||
<menuitem id="menu_fp_config"
|
||||
name="Configuration"
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- ===== Certification List ===== -->
|
||||
<record id="view_fp_operator_cert_list" model="ir.ui.view">
|
||||
<field name="name">fp.operator.cert.list</field>
|
||||
<field name="model">fp.operator.certification</field>
|
||||
<field name="arch" type="xml">
|
||||
<list decoration-success="state == 'active'"
|
||||
decoration-danger="state == 'expired'"
|
||||
decoration-muted="state == 'revoked'">
|
||||
<field name="employee_id"/>
|
||||
<field name="process_type_id"/>
|
||||
<field name="issued_date"/>
|
||||
<field name="expires_date"/>
|
||||
<field name="issued_by_id" optional="show"/>
|
||||
<field name="state" widget="badge"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ===== Certification Form ===== -->
|
||||
<record id="view_fp_operator_cert_form" model="ir.ui.view">
|
||||
<field name="name">fp.operator.cert.form</field>
|
||||
<field name="model">fp.operator.certification</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header>
|
||||
<button name="action_revoke" string="Revoke"
|
||||
type="object" class="btn-danger"
|
||||
invisible="state != 'active'"
|
||||
confirm="Revoke this certification?"/>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h2><field name="name" readonly="1"/></h2>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="employee_id"/>
|
||||
<field name="process_type_id"/>
|
||||
<field name="issued_by_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="issued_date"/>
|
||||
<field name="expires_date"/>
|
||||
<field name="training_record_attachment_id"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="Revocation" invisible="state != 'revoked'">
|
||||
<field name="revoked_reason" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
<group string="Notes">
|
||||
<field name="notes" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
</sheet>
|
||||
<chatter/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ===== Search ===== -->
|
||||
<record id="view_fp_operator_cert_search" model="ir.ui.view">
|
||||
<field name="name">fp.operator.cert.search</field>
|
||||
<field name="model">fp.operator.certification</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="employee_id"/>
|
||||
<field name="process_type_id"/>
|
||||
<filter name="active" string="Active"
|
||||
domain="[('state', '=', 'active')]"/>
|
||||
<filter name="expired" string="Expired"
|
||||
domain="[('state', '=', 'expired')]"/>
|
||||
<filter name="expiring_soon" string="Expiring within 30 days"
|
||||
domain="[('expires_date', '<=', (context_today() + datetime.timedelta(days=30)).strftime('%Y-%m-%d')),
|
||||
('expires_date', '>=', context_today().strftime('%Y-%m-%d')),
|
||||
('state', '=', 'active')]"/>
|
||||
<separator/>
|
||||
<group>
|
||||
<filter name="group_employee" string="Operator"
|
||||
context="{'group_by': 'employee_id'}"/>
|
||||
<filter name="group_process" string="Process"
|
||||
context="{'group_by': 'process_type_id'}"/>
|
||||
<filter name="group_state" string="Status"
|
||||
context="{'group_by': 'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_fp_operator_cert" model="ir.actions.act_window">
|
||||
<field name="name">Operator Certifications</field>
|
||||
<field name="res_model">fp.operator.certification</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="search_view_id" ref="view_fp_operator_cert_search"/>
|
||||
<field name="context">{'search_default_active': 1}</field>
|
||||
</record>
|
||||
|
||||
<!-- Extend employee form with a smart list of certs -->
|
||||
<record id="view_hr_employee_fp_certs" model="ir.ui.view">
|
||||
<field name="name">hr.employee.form.fp.certs</field>
|
||||
<field name="model">hr.employee</field>
|
||||
<field name="inherit_id" ref="hr.view_employee_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//notebook" position="inside">
|
||||
<page string="Plating Certifications" name="fp_certs">
|
||||
<field name="x_fc_certification_ids"
|
||||
context="{'default_employee_id': id}">
|
||||
<list editable="bottom">
|
||||
<field name="process_type_id"/>
|
||||
<field name="issued_date"/>
|
||||
<field name="expires_date"/>
|
||||
<field name="state" widget="badge"/>
|
||||
</list>
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user