Files
Odoo-Modules/fusion_plating/fusion_plating_quality/models/fp_calibration_event.py
gsinghpal 8c76a16366 chore(plating): de-dash shipped code + intake-neutral customer emails
Replace em-dashes and en-dashes with hyphens across 789 shipped source
files (py/xml/js/scss) so the delivered module reads as human-written;
em-dashes had become a recognizable AI-generated tell. Internal .md dev
notes are excluded. The WO-sticker mojibake strippers keep their dash
search targets (now written — / –). No logic changes: comments
and display strings only; validated with py_compile + lxml parse.

Rewrite the 7 customer notification emails to be intake-neutral
(ship-in / drop-off / pickup) and repair-aware, and fix the Shipped
email documents line (packing slip vs bill of lading; certificate only
when issued). Subjects use a hyphen separator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 00:16:19 -04:00

94 lines
2.9 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 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'