Files
Odoo-Modules/fusion_plating/fusion_plating_receiving/models/fp_receiving_damage.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

52 lines
2.0 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 FpReceivingDamage(models.Model):
"""Damage log entry on a receiving record.
Documents condition issues found during parts inspection:
severity, photos, required action, and customer follow-up.
"""
_name = 'fp.receiving.damage'
_description = 'Fusion Plating - Receiving Damage'
_order = 'id'
receiving_id = fields.Many2one(
'fp.receiving', string='Receiving', required=True, ondelete='cascade',
)
description = fields.Text(string='Description', required=True, help='What is damaged.')
severity = fields.Selection(
[('cosmetic', 'Cosmetic'), ('functional', 'Functional'), ('rejected', 'Rejected')],
string='Severity', required=True, default='cosmetic',
)
photo_ids = fields.Many2many(
'ir.attachment', 'fp_receiving_damage_photo_rel', 'damage_id', 'attachment_id',
string='Photos',
)
action_required = fields.Selection(
[('none', 'None'), ('notify_customer', 'Notify Customer'),
('return_parts', 'Return Parts'), ('proceed_as_is', 'Proceed As-Is')],
string='Action Required', default='none',
)
customer_notified = fields.Boolean(string='Customer Notified')
customer_response = fields.Text(string='Customer Response')
resolved = fields.Boolean(string='Resolved')
@api.depends('severity', 'description', 'receiving_id')
def _compute_display_name(self):
labels = dict(self._fields['severity'].selection)
for rec in self:
severity = labels.get(rec.severity, rec.severity or '')
desc = (rec.description or '').strip().split('\n', 1)[0][:40]
bits = []
if severity:
bits.append(severity)
if desc:
bits.append(desc)
rec.display_name = ': '.join(bits) or 'Damage'