133 lines
4.1 KiB
Python
133 lines
4.1 KiB
Python
# -*- 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 FpNadcapAudit(models.Model):
|
|
"""Nadcap AC7108 chemical-processing audit record.
|
|
|
|
Tracks a single Nadcap audit against AC7108 (base checklist) and its
|
|
slash sheets. This is deliberately kept separate from the generic
|
|
fusion.plating.audit model in the quality module because Nadcap has
|
|
its own accreditation lifecycle, PRI-assigned auditors, and
|
|
merit/NCR tracking that don't map cleanly to the generic audit flow.
|
|
"""
|
|
_name = 'fusion.plating.nadcap.audit'
|
|
_description = 'Fusion Plating — Nadcap AC7108 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_date = fields.Date(
|
|
string='Audit Date',
|
|
tracking=True,
|
|
)
|
|
auditor_name = fields.Char(
|
|
string='Auditor',
|
|
tracking=True,
|
|
help='Name of the individual auditor performing the assessment.',
|
|
)
|
|
pri_auditor = fields.Boolean(
|
|
string='PRI-Assigned Auditor',
|
|
tracking=True,
|
|
help='Checked when the auditor was assigned by the Performance '
|
|
'Review Institute rather than a self-nomination.',
|
|
)
|
|
checklist = fields.Selection(
|
|
[
|
|
('ac7108_base', 'AC7108 — Base Checklist'),
|
|
('ac7108_10_electroless', 'AC7108/10 — Electroless Nickel'),
|
|
('ac7108_11_brush', 'AC7108/11 — Brush Plating'),
|
|
('ac7108_12_chrome', 'AC7108/12 — Chromium Plating'),
|
|
('ac7108_13_anodize', 'AC7108/13 — Anodize'),
|
|
('ac7108_14_conv', 'AC7108/14 — Conversion Coating'),
|
|
],
|
|
string='Checklist',
|
|
default='ac7108_base',
|
|
required=True,
|
|
tracking=True,
|
|
)
|
|
result = fields.Selection(
|
|
[
|
|
('accredited', 'Accredited'),
|
|
('conditional', 'Conditional'),
|
|
('failed', 'Failed'),
|
|
],
|
|
string='Result',
|
|
tracking=True,
|
|
)
|
|
merit_count = fields.Integer(
|
|
string='Merits',
|
|
help='Count of merit-worthy observations recorded during the '
|
|
'audit (positive findings).',
|
|
)
|
|
ncr_count = fields.Integer(
|
|
string='NCRs',
|
|
help='Non-conformance reports raised during the audit.',
|
|
)
|
|
audit_report_attachment = fields.Many2one(
|
|
'ir.attachment',
|
|
string='Audit Report',
|
|
help='Final audit report PDF.',
|
|
)
|
|
accreditation_start = fields.Date(
|
|
string='Accreditation Start',
|
|
tracking=True,
|
|
)
|
|
accreditation_end = fields.Date(
|
|
string='Accreditation End',
|
|
tracking=True,
|
|
)
|
|
state = fields.Selection(
|
|
[
|
|
('scheduled', 'Scheduled'),
|
|
('in_progress', 'In Progress'),
|
|
('report_issued', 'Report Issued'),
|
|
('closed', 'Closed'),
|
|
],
|
|
string='Status',
|
|
default='scheduled',
|
|
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.nadcap.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)
|
|
|
|
def action_start(self):
|
|
self.write({'state': 'in_progress'})
|
|
|
|
def action_issue_report(self):
|
|
self.write({'state': 'report_issued'})
|
|
|
|
def action_close(self):
|
|
self.write({'state': 'closed'})
|