Files
Odoo-Modules/fusion_plating/fusion_plating_jobs/models/fp_racking_inspection.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

57 lines
1.9 KiB
Python

# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
#
# Phase 3 / Phase 9 - native-job link on fp.racking.inspection.
# Coexists with the legacy production_id (mrp.production) link; either
# (or both) may be set.
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class FpRackingInspection(models.Model):
_inherit = 'fp.racking.inspection'
# x_fc_job_id is declared in the base receiving module so its views
# can reference it. We add help/depends here.
@api.depends('x_fc_job_id.name', 'partner_id.name')
def _compute_name(self):
for rec in self:
if rec.x_fc_job_id:
rec.name = _('Inspection - %s') % rec.x_fc_job_id.name
else:
rec.name = _('Racking Inspection')
@api.depends('x_fc_job_id.sale_order_id')
def _compute_sale_order(self):
for rec in self:
so = (rec.x_fc_job_id.sale_order_id
if rec.x_fc_job_id and rec.x_fc_job_id.sale_order_id
else False)
rec.sale_order_id = so or False
rec.partner_id = so.partner_id if so else False
@api.constrains('x_fc_job_id')
def _check_link_present(self):
for rec in self:
if not rec.x_fc_job_id:
raise ValidationError(_(
'Racking inspection must reference a plating job.'
))
@api.constrains('x_fc_job_id')
def _check_job_unique(self):
for rec in self:
if not rec.x_fc_job_id:
continue
dup = self.search_count([
('x_fc_job_id', '=', rec.x_fc_job_id.id),
('id', '!=', rec.id),
])
if dup:
raise ValidationError(_(
'Only one racking inspection per plating job.'
))