Files
Odoo-Modules/fusion_plating/fusion_plating_notifications/models/fp_notification_log.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

49 lines
1.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
from .fp_notification_template import TRIGGER_EVENTS
class FpNotificationLog(models.Model):
"""Audit trail for sent notifications."""
_name = 'fp.notification.log'
_description = 'Fusion Plating - Notification Log'
_order = 'sent_date desc, id desc'
template_id = fields.Many2one(
'fp.notification.template', string='Template', ondelete='set null',
)
trigger_event = fields.Selection(TRIGGER_EVENTS, string='Trigger Event')
sale_order_id = fields.Many2one('sale.order', string='Sale Order')
partner_id = fields.Many2one('res.partner', string='Customer')
sent_date = fields.Datetime(string='Sent Date', default=fields.Datetime.now)
recipient_email = fields.Char(string='Recipient Email')
attachment_names = fields.Text(string='Attachments')
status = fields.Selection(
[('sent', 'Sent'), ('failed', 'Failed')],
string='Status', default='sent',
)
error_message = fields.Text(string='Error Message')
mail_mail_id = fields.Many2one('mail.mail', string='Mail Record')
@api.depends('template_id', 'partner_id', 'sent_date', 'status')
def _compute_display_name(self):
trigger_labels = dict(self._fields['trigger_event'].selection)
for rec in self:
bits = []
label = (
rec.template_id.display_name
or trigger_labels.get(rec.trigger_event)
or 'Notification'
)
bits.append(label)
if rec.partner_id:
bits.append('%s' % rec.partner_id.display_name)
if rec.sent_date:
bits.append(rec.sent_date.strftime('%Y-%m-%d %H:%M'))
rec.display_name = ' '.join(bits)