folder rename

This commit is contained in:
gsinghpal
2026-04-16 20:53:53 -04:00
parent 3f3ddcbab4
commit 7c7ef06057
634 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
from . import fp_ncr
from . import fp_capa
from . import fp_calibration
from . import fp_calibration_event
from . import fp_avl
from . import fp_customer_spec
from . import fp_audit
from . import fp_fair
from . import fp_doc_control
from . import fp_quality_hold

View File

@@ -0,0 +1,121 @@
# -*- 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 FpAudit(models.Model):
"""Internal, customer, certification, or supplier audit.
Holds the planning, execution, and findings for any audit the shop
is involved in. Findings drive CAPAs through the optional many-to-many
relationship.
"""
_name = 'fusion.plating.audit'
_description = 'Fusion Plating — Audit'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'audit_date desc, id desc'
name = fields.Char(
string='Reference',
required=True,
copy=False,
readonly=True,
default=lambda self: self._default_name(),
tracking=True,
)
audit_type = fields.Selection(
[
('internal', 'Internal'),
('customer', 'Customer'),
('certification', 'Certification Body'),
('supplier', 'Supplier'),
],
string='Type',
default='internal',
required=True,
tracking=True,
)
scope = fields.Char(
string='Scope',
tracking=True,
)
facility_id = fields.Many2one(
'fusion.plating.facility',
string='Facility',
tracking=True,
)
company_id = fields.Many2one(
'res.company',
related='facility_id.company_id',
store=True,
readonly=True,
)
auditor_ids = fields.Many2many(
'res.users',
'fp_audit_auditor_rel',
'audit_id',
'user_id',
string='Auditors',
)
audit_date = fields.Date(
string='Audit Date',
tracking=True,
)
state = fields.Selection(
[
('planned', 'Planned'),
('in_progress', 'In Progress'),
('findings', 'Findings'),
('closed', 'Closed'),
],
string='Status',
default='planned',
required=True,
tracking=True,
)
findings_count = fields.Integer(
string='# Findings',
)
findings_html = fields.Html(
string='Findings',
)
capa_ids = fields.Many2many(
'fusion.plating.capa',
'fp_audit_capa_rel',
'audit_id',
'capa_id',
string='CAPAs',
)
capa_count = fields.Integer(
compute='_compute_capa_count',
)
active = fields.Boolean(default=True)
@api.model
def _default_name(self):
seq = self.env['ir.sequence'].next_by_code('fusion.plating.audit')
return seq or '/'
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if not vals.get('name') or vals.get('name') == '/':
vals['name'] = self._default_name()
return super().create(vals_list)
@api.depends('capa_ids')
def _compute_capa_count(self):
for rec in self:
rec.capa_count = len(rec.capa_ids)
def action_start(self):
self.write({'state': 'in_progress'})
def action_findings(self):
self.write({'state': 'findings'})
def action_close(self):
self.write({'state': 'closed'})

View File

@@ -0,0 +1,124 @@
# -*- 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 FpAvl(models.Model):
"""Approved Vendor List entry.
The AVL ties an approval state to a res.partner. Each entry tracks
approval date, expiry, scorecard rating, and what processes the
vendor is approved to supply for. Suspended or removed vendors stay
in the list for traceability.
"""
_name = 'fusion.plating.avl'
_description = 'Fusion Plating — Approved Vendor List'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'state, name'
_rec_name = 'name'
name = fields.Char(
string='Vendor',
compute='_compute_name',
store=True,
)
partner_id = fields.Many2one(
'res.partner',
string='Partner',
required=True,
tracking=True,
)
company_id = fields.Many2one(
'res.company',
string='Company',
default=lambda self: self.env.company,
)
category = fields.Selection(
[
('chemical', 'Chemical'),
('equipment', 'Equipment'),
('service', 'Service'),
('lab', 'Lab / Calibration'),
('shipping', 'Shipping'),
('other', 'Other'),
],
string='Category',
default='chemical',
tracking=True,
)
approval_date = fields.Date(
string='Approval Date',
tracking=True,
)
approval_expiry = fields.Date(
string='Approval Expiry',
tracking=True,
)
state = fields.Selection(
[
('pending', 'Pending'),
('approved', 'Approved'),
('conditional', 'Conditional'),
('suspended', 'Suspended'),
('removed', 'Removed'),
],
string='Status',
default='pending',
required=True,
tracking=True,
)
approved_for = fields.Char(
string='Approved For',
help='Free text — what processes / products / services this vendor '
'is approved to supply.',
)
notes = fields.Html(
string='Notes',
)
scorecard_rating = fields.Float(
string='Scorecard',
help='0 to 5 rating from the most recent vendor scorecard.',
)
is_expired = fields.Boolean(
string='Expired',
compute='_compute_is_expired',
search='_search_is_expired',
)
active = fields.Boolean(default=True)
@api.depends('partner_id')
def _compute_name(self):
for rec in self:
rec.name = rec.partner_id.name or 'New Vendor'
@api.depends('approval_expiry')
def _compute_is_expired(self):
today = fields.Date.context_today(self)
for rec in self:
rec.is_expired = bool(
rec.approval_expiry and rec.approval_expiry < today
)
def _search_is_expired(self, operator, value):
today = fields.Date.context_today(self)
if (operator == '=' and value) or (operator == '!=' and not value):
return [('approval_expiry', '<', today)]
return ['|', ('approval_expiry', '>=', today), ('approval_expiry', '=', False)]
def action_approve(self):
self.write({
'state': 'approved',
'approval_date': fields.Date.context_today(self),
})
def action_suspend(self):
self.write({'state': 'suspended'})
def action_remove(self):
self.write({'state': 'removed'})
def action_reinstate(self):
self.write({'state': 'approved'})

View File

@@ -0,0 +1,171 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
from datetime import timedelta
from odoo import api, fields, models
class FpCalibrationEquipment(models.Model):
"""Equipment master for the calibration register.
Holds the metadata about each measuring instrument the shop owns:
type, NIST traceability, calibration interval, and computed
next-due date. Individual events live on
fusion.plating.calibration.event.
"""
_name = 'fusion.plating.calibration.equipment'
_description = 'Fusion Plating — Calibrated Equipment'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'next_cal_date asc, name'
name = fields.Char(
string='Equipment',
required=True,
tracking=True,
)
code = fields.Char(
string='Asset Code',
required=True,
tracking=True,
)
equipment_type = fields.Selection(
[
('xrf', 'XRF Analyzer'),
('ph_meter', 'pH Meter'),
('thermocouple', 'Thermocouple'),
('balance', 'Balance / Scale'),
('timer', 'Timer'),
('thickness_gauge', 'Thickness Gauge'),
('multimeter', 'Multimeter'),
('other', 'Other'),
],
string='Type',
default='other',
tracking=True,
)
facility_id = fields.Many2one(
'fusion.plating.facility',
string='Facility',
tracking=True,
)
company_id = fields.Many2one(
'res.company',
related='facility_id.company_id',
store=True,
readonly=True,
)
nist_traceable = fields.Boolean(
string='NIST Traceable',
default=True,
)
calibration_interval_days = fields.Integer(
string='Interval (days)',
default=365,
help='Number of days between calibrations.',
)
last_cal_date = fields.Date(
string='Last Calibration',
compute='_compute_cal_dates',
store=True,
)
next_cal_date = fields.Date(
string='Next Calibration',
compute='_compute_cal_dates',
store=True,
)
state = fields.Selection(
[
('in_service', 'In Service'),
('due_soon', 'Due Soon'),
('overdue', 'Overdue'),
('out_of_service', 'Out of Service'),
],
string='Status',
compute='_compute_state',
store=True,
tracking=True,
)
manual_state = fields.Selection(
[
('in_service', 'In Service'),
('out_of_service', 'Out of Service'),
],
string='Manual Override',
default='in_service',
help='Use this to mark a unit out-of-service even if it is not yet '
'overdue (e.g. damaged in transit).',
tracking=True,
)
active = fields.Boolean(default=True)
event_ids = fields.One2many(
'fusion.plating.calibration.event',
'equipment_id',
string='Calibration Events',
)
event_count = fields.Integer(
compute='_compute_event_count',
)
_sql_constraints = [
(
'fp_cal_equipment_code_uniq',
'unique(code, company_id)',
'Asset code must be unique per company.',
),
]
@api.depends('event_ids', 'event_ids.cal_date', 'calibration_interval_days')
def _compute_cal_dates(self):
for rec in self:
last_event = rec.event_ids.sorted('cal_date', reverse=True)[:1]
rec.last_cal_date = last_event.cal_date if last_event else False
if rec.last_cal_date and rec.calibration_interval_days:
rec.next_cal_date = rec.last_cal_date + timedelta(
days=rec.calibration_interval_days
)
else:
rec.next_cal_date = False
@api.depends('next_cal_date', 'manual_state')
def _compute_state(self):
today = fields.Date.context_today(self)
for rec in self:
if rec.manual_state == 'out_of_service':
rec.state = 'out_of_service'
continue
if not rec.next_cal_date:
rec.state = 'in_service'
continue
days_left = (rec.next_cal_date - today).days
if days_left < 0:
rec.state = 'overdue'
elif days_left <= 14:
rec.state = 'due_soon'
else:
rec.state = 'in_service'
@api.depends('event_ids')
def _compute_event_count(self):
for rec in self:
rec.event_count = len(rec.event_ids)
def action_mark_out_of_service(self):
self.write({'manual_state': 'out_of_service'})
def action_return_to_service(self):
self.write({'manual_state': 'in_service'})
def action_view_events(self):
self.ensure_one()
return {
'name': 'Calibration Events',
'type': 'ir.actions.act_window',
'res_model': 'fusion.plating.calibration.event',
'view_mode': 'list,form',
'domain': [('equipment_id', '=', self.id)],
'context': {'default_equipment_id': self.id},
}

View File

@@ -0,0 +1,93 @@
# -*- 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 FpCalibrationEvent(models.Model):
"""A single calibration event against a piece of equipment.
Captures who calibrated it, the result (pass / limited / fail), the
as-found and as-left readings, and the certificate reference. A failed
calibration carries an impact_assessment field so the QM can document
which jobs may have been measured by an out-of-tolerance instrument.
"""
_name = 'fusion.plating.calibration.event'
_description = 'Fusion Plating — Calibration Event'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'cal_date desc, id desc'
_rec_name = 'display_name'
equipment_id = fields.Many2one(
'fusion.plating.calibration.equipment',
string='Equipment',
required=True,
ondelete='cascade',
tracking=True,
)
display_name = fields.Char(
compute='_compute_display_name',
store=True,
)
cal_date = fields.Date(
string='Calibration Date',
required=True,
default=lambda self: fields.Date.context_today(self),
tracking=True,
)
performed_by_id = fields.Many2one(
'res.users',
string='Performed By',
default=lambda self: self.env.user,
tracking=True,
)
performed_by_external = fields.Char(
string='External Calibration House',
help='If calibrated by an outside lab, name them here.',
)
result = fields.Selection(
[
('pass', 'Pass'),
('limited', 'Pass with Limitations'),
('fail', 'Fail'),
],
string='Result',
required=True,
default='pass',
tracking=True,
)
as_found_notes = fields.Text(
string='As-Found Readings',
)
as_left_notes = fields.Text(
string='As-Left Readings',
)
certificate_ref = fields.Char(
string='Certificate #',
)
impact_assessment = fields.Html(
string='Impact Assessment',
help='If the result is Fail or Limited, document which jobs / parts '
'were measured by this instrument since the last calibration.',
)
facility_id = fields.Many2one(
related='equipment_id.facility_id',
store=True,
readonly=True,
)
company_id = fields.Many2one(
'res.company',
related='equipment_id.company_id',
store=True,
readonly=True,
)
@api.depends('equipment_id.code', 'cal_date')
def _compute_display_name(self):
for rec in self:
if rec.equipment_id and rec.cal_date:
rec.display_name = f'{rec.equipment_id.code}{rec.cal_date}'
else:
rec.display_name = 'Calibration Event'

View File

@@ -0,0 +1,166 @@
# -*- 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 FpCapa(models.Model):
"""Corrective and Preventive Action.
A CAPA carries an issue from "we found a problem" all the way to
"we proved the fix worked". Each CAPA has an owner, a due date, an
action plan, and an effectiveness verification step.
"""
_name = 'fusion.plating.capa'
_description = 'Fusion Plating — Corrective / Preventive Action'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'due_date asc, id desc'
name = fields.Char(
string='Reference',
required=True,
copy=False,
readonly=True,
default=lambda self: self._default_name(),
tracking=True,
)
state = fields.Selection(
[
('draft', 'Draft'),
('analysis', 'Analysis'),
('implementation', 'Implementation'),
('verification', 'Verification'),
('effective', 'Effective'),
('not_effective', 'Not Effective'),
('closed', 'Closed'),
],
string='Status',
default='draft',
required=True,
tracking=True,
)
type = fields.Selection(
[
('corrective', 'Corrective'),
('preventive', 'Preventive'),
],
string='Type',
default='corrective',
required=True,
tracking=True,
)
ncr_id = fields.Many2one(
'fusion.plating.ncr',
string='Source NCR',
ondelete='set null',
tracking=True,
)
facility_id = fields.Many2one(
'fusion.plating.facility',
string='Facility',
related='ncr_id.facility_id',
store=True,
readonly=False,
)
company_id = fields.Many2one(
'res.company',
related='facility_id.company_id',
store=True,
readonly=True,
)
description = fields.Html(string='Description')
root_cause_analysis = fields.Html(
string='Root Cause Analysis',
help='Use 5 Whys, fishbone, or any structured method.',
)
action_plan = fields.Html(string='Action Plan')
owner_id = fields.Many2one(
'res.users',
string='Owner',
required=True,
default=lambda self: self.env.user,
tracking=True,
)
due_date = fields.Date(string='Due Date', tracking=True)
verification_date = fields.Date(string='Verification Date', tracking=True)
verification_by_id = fields.Many2one(
'res.users',
string='Verified By',
tracking=True,
)
is_effective = fields.Boolean(string='Effective', tracking=True)
effectiveness_notes = fields.Html(string='Effectiveness Notes')
is_overdue = fields.Boolean(
string='Overdue',
compute='_compute_is_overdue',
search='_search_is_overdue',
)
active = fields.Boolean(default=True)
@api.model
def _default_name(self):
seq = self.env['ir.sequence'].next_by_code('fusion.plating.capa')
return seq or '/'
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if not vals.get('name') or vals.get('name') == '/':
vals['name'] = self._default_name()
return super().create(vals_list)
@api.depends('due_date', 'state')
def _compute_is_overdue(self):
today = fields.Date.context_today(self)
for rec in self:
rec.is_overdue = bool(
rec.due_date
and rec.state not in ('effective', 'closed')
and rec.due_date < today
)
def _search_is_overdue(self, operator, value):
today = fields.Date.context_today(self)
if (operator == '=' and value) or (operator == '!=' and not value):
return [
('due_date', '<', today),
('state', 'not in', ['effective', 'closed']),
]
return [
'|',
('due_date', '>=', today),
('state', 'in', ['effective', 'closed']),
]
def action_start_analysis(self):
self.write({'state': 'analysis'})
def action_start_implementation(self):
self.write({'state': 'implementation'})
def action_start_verification(self):
self.write({'state': 'verification'})
def action_mark_effective(self):
self.write({
'state': 'effective',
'is_effective': True,
'verification_date': fields.Date.context_today(self),
'verification_by_id': self.env.user.id,
})
def action_mark_not_effective(self):
self.write({
'state': 'not_effective',
'is_effective': False,
'verification_date': fields.Date.context_today(self),
'verification_by_id': self.env.user.id,
})
def action_close(self):
self.write({'state': 'closed'})
def action_reset_to_draft(self):
self.write({'state': 'draft'})

View File

@@ -0,0 +1,99 @@
# -*- 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 fields, models
class FpCustomerSpec(models.Model):
"""Customer specification library entry.
Holds the metadata about a specification (industry, customer, or
internal) so jobs and process types can reference it. The actual
document lives at document_url — could be a SharePoint link, a
Google Drive URL, or any other location the shop already uses.
"""
_name = 'fusion.plating.customer.spec'
_description = 'Fusion Plating — Customer Specification'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'spec_type, code, revision desc'
_rec_name = 'display_name'
name = fields.Char(
string='Title',
required=True,
tracking=True,
)
display_name = fields.Char(
compute='_compute_display_name',
store=True,
)
code = fields.Char(
string='Spec Code',
required=True,
tracking=True,
help='e.g. AMS 2404, ASTM B733, MIL-C-26074',
)
revision = fields.Char(
string='Revision',
tracking=True,
)
effective_date = fields.Date(
string='Effective Date',
tracking=True,
)
partner_id = fields.Many2one(
'res.partner',
string='Customer',
help='Leave blank for industry / internal specs.',
)
process_type_ids = fields.Many2many(
'fusion.plating.process.type',
'fp_customer_spec_process_rel',
'spec_id',
'process_type_id',
string='Applicable Processes',
)
spec_type = fields.Selection(
[
('industry', 'Industry / Standard'),
('customer', 'Customer'),
('internal', 'Internal'),
],
string='Type',
default='industry',
required=True,
tracking=True,
)
document_url = fields.Char(
string='Document URL',
help='Link to the controlled copy of the specification (SharePoint, '
'Google Drive, etc.).',
)
notes = fields.Html(
string='Notes',
)
company_id = fields.Many2one(
'res.company',
string='Company',
default=lambda self: self.env.company,
)
active = fields.Boolean(default=True)
_sql_constraints = [
(
'fp_customer_spec_code_rev_uniq',
'unique(code, revision, company_id)',
'A specification at the same revision must be unique per company.',
),
]
def _compute_display_name(self):
for rec in self:
parts = [rec.code or '']
if rec.revision:
parts.append(f'Rev {rec.revision}')
if rec.name:
parts.append(f'{rec.name}')
rec.display_name = ' '.join(p for p in parts if p)

View File

@@ -0,0 +1,110 @@
# -*- 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 fields, models
class FpDocControl(models.Model):
"""Controlled document register.
Lightweight document control without depending on the Enterprise
`documents` or `sign` modules. Each entry tracks the document name,
revision, owner, lifecycle state, and the list of operators trained
on this revision (a common audit ask).
"""
_name = 'fusion.plating.doc.control'
_description = 'Fusion Plating — Controlled Document'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'doc_type, name, revision desc'
name = fields.Char(
string='Title',
required=True,
tracking=True,
)
doc_type = fields.Selection(
[
('procedure', 'Procedure'),
('work_instruction', 'Work Instruction'),
('form', 'Form'),
('standard', 'Standard'),
('manual', 'Manual'),
],
string='Type',
default='procedure',
required=True,
tracking=True,
)
revision = fields.Char(
string='Revision',
required=True,
tracking=True,
)
effective_date = fields.Date(
string='Effective Date',
tracking=True,
)
review_date = fields.Date(
string='Next Review',
tracking=True,
)
owner_id = fields.Many2one(
'res.users',
string='Owner',
default=lambda self: self.env.user,
tracking=True,
)
state = fields.Selection(
[
('draft', 'Draft'),
('in_review', 'In Review'),
('approved', 'Approved'),
('effective', 'Effective'),
('obsolete', 'Obsolete'),
],
string='Status',
default='draft',
required=True,
tracking=True,
)
attachment_ids = fields.Many2many(
'ir.attachment',
'fp_doc_control_attachment_rel',
'doc_id',
'attachment_id',
string='Attachments',
)
trained_user_ids = fields.Many2many(
'res.users',
'fp_doc_control_trained_rel',
'doc_id',
'user_id',
string='Trained Users',
help='Operators who have been trained on this revision of the document.',
)
company_id = fields.Many2one(
'res.company',
string='Company',
default=lambda self: self.env.company,
)
active = fields.Boolean(default=True)
def action_submit_for_review(self):
self.write({'state': 'in_review'})
def action_approve(self):
self.write({'state': 'approved'})
def action_make_effective(self):
self.write({
'state': 'effective',
'effective_date': fields.Date.context_today(self),
})
def action_mark_obsolete(self):
self.write({'state': 'obsolete'})
def action_reset_to_draft(self):
self.write({'state': 'draft'})

View File

@@ -0,0 +1,116 @@
# -*- 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 FpFair(models.Model):
"""First Article Inspection Report (FAIR).
Captures the documented first-article inspection for a part at a
specific revision. Used heavily in aerospace and automotive: every
new part number, every revision change, every customer-mandated
PPAP needs a FAIR on file.
"""
_name = 'fusion.plating.fair'
_description = 'Fusion Plating — First Article Inspection Report'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'performed_date desc, id desc'
name = fields.Char(
string='Reference',
required=True,
copy=False,
readonly=True,
default=lambda self: self._default_name(),
tracking=True,
)
part_number = fields.Char(
string='Part Number',
required=True,
tracking=True,
)
part_revision = fields.Char(
string='Part Revision',
tracking=True,
)
customer_id = fields.Many2one(
'res.partner',
string='Customer',
tracking=True,
)
process_type_ids = fields.Many2many(
'fusion.plating.process.type',
'fp_fair_process_rel',
'fair_id',
'process_type_id',
string='Processes',
)
performed_date = fields.Date(
string='Inspection Date',
default=lambda self: fields.Date.context_today(self),
tracking=True,
)
performed_by_id = fields.Many2one(
'res.users',
string='Inspector',
default=lambda self: self.env.user,
tracking=True,
)
result = fields.Selection(
[
('pass', 'Pass'),
('fail', 'Fail'),
('conditional', 'Conditional'),
],
string='Result',
default='pass',
tracking=True,
)
state = fields.Selection(
[
('draft', 'Draft'),
('in_review', 'In Review'),
('approved', 'Approved'),
('rejected', 'Rejected'),
],
string='Status',
default='draft',
required=True,
tracking=True,
)
notes = fields.Html(
string='Notes',
)
company_id = fields.Many2one(
'res.company',
string='Company',
default=lambda self: self.env.company,
)
active = fields.Boolean(default=True)
@api.model
def _default_name(self):
seq = self.env['ir.sequence'].next_by_code('fusion.plating.fair')
return seq or '/'
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if not vals.get('name') or vals.get('name') == '/':
vals['name'] = self._default_name()
return super().create(vals_list)
def action_submit_for_review(self):
self.write({'state': 'in_review'})
def action_approve(self):
self.write({'state': 'approved'})
def action_reject(self):
self.write({'state': 'rejected'})
def action_reset_to_draft(self):
self.write({'state': 'draft'})

View File

@@ -0,0 +1,176 @@
# -*- 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 FpNcr(models.Model):
"""Non-Conformance Report.
The NCR is the entry point of the Fusion Plating QMS. Anything that
falls outside of spec — a chemistry deviation, a customer return, an
inspection failure, an audit observation — is opened as an NCR and
walked through containment, disposition, and closure.
"""
_name = 'fusion.plating.ncr'
_description = 'Fusion Plating — Non-Conformance Report'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'reported_date desc, id desc'
name = fields.Char(
string='Reference',
required=True,
copy=False,
readonly=True,
default=lambda self: self._default_name(),
tracking=True,
)
state = fields.Selection(
[
('draft', 'Draft'),
('open', 'Open'),
('containment', 'Containment'),
('disposition', 'Disposition'),
('closed', 'Closed'),
],
string='Status',
default='draft',
required=True,
tracking=True,
)
facility_id = fields.Many2one(
'fusion.plating.facility',
string='Facility',
required=True,
tracking=True,
)
company_id = fields.Many2one(
'res.company',
related='facility_id.company_id',
store=True,
readonly=True,
)
reported_by_id = fields.Many2one(
'res.users',
string='Reported By',
default=lambda self: self.env.user,
tracking=True,
)
reported_date = fields.Datetime(
string='Reported On',
default=lambda self: fields.Datetime.now(),
tracking=True,
)
closed_date = fields.Datetime(
string='Closed On',
readonly=True,
tracking=True,
)
source = fields.Selection(
[
('shop_floor', 'Shop Floor'),
('inspection', 'Inspection'),
('customer', 'Customer'),
('audit', 'Audit'),
('supplier', 'Supplier'),
('other', 'Other'),
],
string='Source',
default='shop_floor',
tracking=True,
)
severity = fields.Selection(
[
('low', 'Low'),
('medium', 'Medium'),
('high', 'High'),
('critical', 'Critical'),
],
string='Severity',
default='medium',
tracking=True,
)
part_ref = fields.Char(string='Part / Lot')
quantity_affected = fields.Float(string='Quantity Affected')
description = fields.Html(string='Description')
root_cause = fields.Html(string='Root Cause')
containment = fields.Html(string='Containment Actions')
disposition = fields.Selection(
[
('use_as_is', 'Use as Is'),
('rework', 'Rework'),
('scrap', 'Scrap'),
('return_to_customer', 'Return to Customer'),
('pending', 'Pending'),
],
string='Disposition',
default='pending',
tracking=True,
)
bath_id = fields.Many2one(
'fusion.plating.bath',
string='Bath',
help='If the non-conformance was caused by a specific chemistry bath.',
)
customer_partner_id = fields.Many2one(
'res.partner',
string='Customer',
)
capa_ids = fields.One2many(
'fusion.plating.capa',
'ncr_id',
string='CAPAs',
)
capa_count = fields.Integer(
string='# CAPAs',
compute='_compute_capa_count',
)
active = fields.Boolean(default=True)
@api.model
def _default_name(self):
seq = self.env['ir.sequence'].next_by_code('fusion.plating.ncr')
return seq or '/'
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if not vals.get('name') or vals.get('name') == '/':
vals['name'] = self._default_name()
return super().create(vals_list)
@api.depends('capa_ids')
def _compute_capa_count(self):
for rec in self:
rec.capa_count = len(rec.capa_ids)
def action_open(self):
self.write({'state': 'open'})
def action_containment(self):
self.write({'state': 'containment'})
def action_disposition(self):
self.write({'state': 'disposition'})
def action_close(self):
self.write({
'state': 'closed',
'closed_date': fields.Datetime.now(),
})
def action_reset_to_draft(self):
self.write({'state': 'draft', 'closed_date': False})
def action_view_capas(self):
self.ensure_one()
return {
'name': 'CAPAs',
'type': 'ir.actions.act_window',
'res_model': 'fusion.plating.capa',
'view_mode': 'list,form',
'domain': [('ncr_id', '=', self.id)],
'context': {'default_ncr_id': self.id},
}

View File

@@ -0,0 +1,184 @@
# -*- 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 FpQualityHold(models.Model):
"""Quality Hold — parts pulled from production for quality review.
Enables the Steelhead-style "Move Parts Into Quality Management"
workflow. An operator can split a partial quantity off a job and
place it on hold for inspection, rework, or scrap.
"""
_name = 'fusion.plating.quality.hold'
_description = 'Fusion Plating — Quality Hold'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'create_date desc'
name = fields.Char(
string='Reference',
required=True,
copy=False,
readonly=True,
default=lambda self: self._default_name(),
tracking=True,
)
# ----- What's on hold -----
# NOTE: workorder_id, production_id, and portal_job_id live in
# fusion_plating_bridge_mrp (which depends on mrp and
# fusion_plating_portal). Keeping them here would force hard
# dependencies and break minimal CE-only installs.
part_ref = fields.Char(string='Part Number')
# ----- Hold details -----
qty_on_hold = fields.Integer(string='Qty on Hold', required=True)
qty_original = fields.Integer(string='Original Qty')
mark_for_scrap = fields.Boolean(string='Mark for Scrap', default=False)
hold_reason = fields.Selection(
[
('damaged', 'Parts Damaged'),
('out_of_spec', 'Out of Specification'),
('contamination', 'Contamination'),
('customer_complaint', 'Customer Complaint'),
('process_deviation', 'Process Deviation'),
('other', 'Other'),
],
string='Hold Reason',
default='other',
tracking=True,
)
description = fields.Text(string='Description')
attachment_ids = fields.Many2many(
'ir.attachment',
string='Attachments',
)
# ----- Location / station context -----
facility_id = fields.Many2one(
'fusion.plating.facility',
string='Facility',
)
work_center_id = fields.Many2one(
'fusion.plating.work.center',
string='Station',
)
current_process_node = fields.Char(string='Current Process Node')
# ----- Status -----
state = fields.Selection(
[
('on_hold', 'On Hold'),
('under_review', 'Under Review'),
('released', 'Released to Production'),
('scrapped', 'Scrapped'),
('reworked', 'Sent to Rework'),
],
string='Status',
default='on_hold',
required=True,
tracking=True,
)
# ----- Resolution -----
ncr_id = fields.Many2one('fusion.plating.ncr', string='Linked NCR')
resolved_by_id = fields.Many2one('res.users', string='Resolved By')
resolution_date = fields.Datetime(string='Resolution Date')
resolution_notes = fields.Text(string='Resolution Notes')
# ----- Housekeeping -----
operator_id = fields.Many2one(
'res.users',
string='Held By',
default=lambda self: self.env.user,
)
company_id = fields.Many2one(
'res.company',
default=lambda self: self.env.company,
)
active = fields.Boolean(default=True)
# ------------------------------------------------------------------
# Defaults / create
# ------------------------------------------------------------------
@api.model
def _default_name(self):
seq = self.env['ir.sequence'].next_by_code(
'fusion.plating.quality.hold',
)
return seq or '/'
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if not vals.get('name') or vals.get('name') == '/':
vals['name'] = self._default_name()
return super().create(vals_list)
# ------------------------------------------------------------------
# Actions
# ------------------------------------------------------------------
def action_start_review(self):
self.write({'state': 'under_review'})
self._post_state_message('Under Review')
def action_release(self):
self.write({
'state': 'released',
'resolved_by_id': self.env.user.id,
'resolution_date': fields.Datetime.now(),
})
self._post_state_message('Released to Production')
def action_scrap(self):
self.write({
'state': 'scrapped',
'mark_for_scrap': True,
'resolved_by_id': self.env.user.id,
'resolution_date': fields.Datetime.now(),
})
self._post_state_message('Scrapped')
def action_send_to_rework(self):
self.write({
'state': 'reworked',
'resolved_by_id': self.env.user.id,
'resolution_date': fields.Datetime.now(),
})
self._post_state_message('Sent to Rework')
def action_create_ncr(self):
"""Create a linked NCR from this hold record."""
self.ensure_one()
ncr = self.env['fusion.plating.ncr'].create({
'facility_id': self.facility_id.id,
'source': 'shop_floor',
'severity': 'medium',
'part_ref': self.part_ref,
'quantity_affected': self.qty_on_hold,
'description': self.description or '',
})
self.write({'ncr_id': ncr.id})
self._post_state_message(f'NCR {ncr.name} created')
return {
'name': 'NCR',
'type': 'ir.actions.act_window',
'res_model': 'fusion.plating.ncr',
'res_id': ncr.id,
'view_mode': 'form',
'target': 'current',
}
# ------------------------------------------------------------------
# Helpers
# ------------------------------------------------------------------
def _post_state_message(self, label):
for rec in self:
rec.message_post(
body=f"Hold status changed to <b>{label}</b>.",
message_type='comment',
subtype_xmlid='mail.mt_note',
)