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>
This commit is contained in:
@@ -14,25 +14,25 @@ TRIGGER_EVENTS = [
|
||||
('so_confirmed', 'Order Confirmed'),
|
||||
('parts_received', 'Parts Received'),
|
||||
('mo_complete', 'Manufacturing Complete'), # legacy, fired by mrp; kept for back-compat
|
||||
('job_confirmed', 'Plating Job Confirmed'), # Sub 11 — fp.job lifecycle
|
||||
('job_complete', 'Plating Job Complete'), # Sub 11 — fp.job.button_mark_done
|
||||
('shipment_labeled', 'Shipping Label Generated'), # Phase C — fired when tracking_number lands on fusion.shipment
|
||||
('job_confirmed', 'Plating Job Confirmed'), # Sub 11 - fp.job lifecycle
|
||||
('job_complete', 'Plating Job Complete'), # Sub 11 - fp.job.button_mark_done
|
||||
('shipment_labeled', 'Shipping Label Generated'), # Phase C - fired when tracking_number lands on fusion.shipment
|
||||
('shipped', 'Shipped / Delivered'),
|
||||
('invoice_posted', 'Invoice Posted'),
|
||||
('payment_received', 'Payment Received'),
|
||||
('deposit_created', 'Deposit Required'),
|
||||
('rma_authorised', 'RMA Authorised'), # Sub 12 — RMA lifecycle
|
||||
('rma_authorised', 'RMA Authorised'), # Sub 12 - RMA lifecycle
|
||||
('rma_received', 'RMA Parts Received'),
|
||||
('rma_resolved', 'RMA Resolved'),
|
||||
# Spec 2026-05-25 — post-shop cert + shipping states
|
||||
# Spec 2026-05-25 - post-shop cert + shipping states
|
||||
('cert_awaiting_issuance', 'Cert Awaiting Issuance'),
|
||||
('cert_voided_re_notify', 'Cert Voided — Please Re-Issue'),
|
||||
('cert_voided_re_notify', 'Cert Voided - Please Re-Issue'),
|
||||
('job_shipped', 'Job Shipped (manual mark)'),
|
||||
# Spec 2026-05-25 — tablet PIN self-service reset
|
||||
# Spec 2026-05-25 - tablet PIN self-service reset
|
||||
('tablet_pin_reset_requested', 'Tablet PIN Reset Code Requested'),
|
||||
]
|
||||
|
||||
# Sub 6 — map each trigger event to a communication stream. Contacts on
|
||||
# Sub 6 - map each trigger event to a communication stream. Contacts on
|
||||
# the customer who opt into that stream (or flag themselves as global)
|
||||
# receive the email. Unmapped events fall back to the company partner's
|
||||
# own email, preserving pre-Sub-6 behaviour.
|
||||
@@ -61,7 +61,7 @@ class FpNotificationTemplate(models.Model):
|
||||
whether the notification fires and what attachments are included.
|
||||
"""
|
||||
_name = 'fp.notification.template'
|
||||
_description = 'Fusion Plating — Notification Template'
|
||||
_description = 'Fusion Plating - Notification Template'
|
||||
_order = 'trigger_event'
|
||||
|
||||
name = fields.Char(string='Template Name', required=True)
|
||||
@@ -93,7 +93,7 @@ class FpNotificationTemplate(models.Model):
|
||||
]
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Central dispatch helper — called from every hook.
|
||||
# Central dispatch helper - called from every hook.
|
||||
# ------------------------------------------------------------------
|
||||
@api.model
|
||||
def _dispatch(self, trigger_event, record, partner=None, sale_order=None,
|
||||
@@ -106,7 +106,7 @@ class FpNotificationTemplate(models.Model):
|
||||
res.partner._fp_resolve_notification_recipients so per-contact
|
||||
flags (certs / qc / quotes_so / invoices / global) and per-
|
||||
delivery-location contacts are honoured. Customers who haven't
|
||||
set any flags fall back to the company partner's email —
|
||||
set any flags fall back to the company partner's email -
|
||||
identical to pre-Sub-6 behaviour.
|
||||
"""
|
||||
template = self.search(
|
||||
@@ -125,7 +125,7 @@ class FpNotificationTemplate(models.Model):
|
||||
if attachment_ids:
|
||||
attachment_names = self.env['ir.attachment'].browse(attachment_ids).mapped('name')
|
||||
|
||||
# Spec 2026-05-25 — cert authority events go to INTERNAL users
|
||||
# Spec 2026-05-25 - cert authority events go to INTERNAL users
|
||||
# (Manager / QM / Owner), not customer contacts. Replace partner-
|
||||
# based resolution with the group-membership resolver.
|
||||
recipient_emails = []
|
||||
@@ -143,7 +143,7 @@ class FpNotificationTemplate(models.Model):
|
||||
)
|
||||
elif partner.email:
|
||||
recipient_emails = [partner.email]
|
||||
# Filter out falsy entries — sub-contacts may have no email and the
|
||||
# Filter out falsy entries - sub-contacts may have no email and the
|
||||
# resolver returns False/None for them. Joining with bool blows up.
|
||||
recipient_emails = [e for e in (recipient_emails or []) if e]
|
||||
recipient_str = ', '.join(recipient_emails)
|
||||
@@ -290,7 +290,7 @@ class FpNotificationTemplate(models.Model):
|
||||
_logger.warning('Failed to render %s: %s', xmlid, exc)
|
||||
return None
|
||||
|
||||
# Resolve the customer record — partner-level flags gate certain
|
||||
# Resolve the customer record - partner-level flags gate certain
|
||||
# documents so customer preferences override template defaults.
|
||||
customer = None
|
||||
if sale_order:
|
||||
@@ -311,14 +311,14 @@ class FpNotificationTemplate(models.Model):
|
||||
return default
|
||||
|
||||
# Both attach_quotation and attach_sale_order point at the same
|
||||
# report today — render once to avoid double attachment.
|
||||
# report today - render once to avoid double attachment.
|
||||
if (self.attach_quotation or self.attach_sale_order) and sale_order:
|
||||
att = _render_report(
|
||||
'fusion_plating_reports.action_report_fp_sale_portrait', sale_order,
|
||||
)
|
||||
if att:
|
||||
ids.append(att)
|
||||
# CoC — gated by customer preference (x_fc_send_coc, default True).
|
||||
# CoC - gated by customer preference (x_fc_send_coc, default True).
|
||||
# Prefer the rich PDF that mrp_production.button_mark_done already
|
||||
# rendered against the fp.certificate (signatures, accreditation
|
||||
# logos, thickness data). The legacy action_report_coc bound to
|
||||
@@ -340,7 +340,7 @@ class FpNotificationTemplate(models.Model):
|
||||
('certificate_type', '=', 'coc'),
|
||||
], order='id desc', limit=1)
|
||||
if cert:
|
||||
# CoC is bilingual now — the single EN action renders
|
||||
# CoC is bilingual now - the single EN action renders
|
||||
# both languages, so there's no per-lang branch.
|
||||
att = _render_report(
|
||||
'fusion_plating_reports.action_report_coc_en', cert,
|
||||
@@ -351,7 +351,7 @@ class FpNotificationTemplate(models.Model):
|
||||
)
|
||||
if att:
|
||||
ids.append(att)
|
||||
# Thickness report — only attach when the customer opted OUT of
|
||||
# Thickness report - only attach when the customer opted OUT of
|
||||
# CoC and ONLY wants thickness. The CoC PDF already embeds
|
||||
# thickness data so attaching both would be a duplicate.
|
||||
if (self.attach_thickness_report and portal_job
|
||||
@@ -374,14 +374,14 @@ class FpNotificationTemplate(models.Model):
|
||||
)
|
||||
if att:
|
||||
ids.append(att)
|
||||
# Packing slip — gated by customer preference (default True)
|
||||
# Packing slip - gated by customer preference (default True)
|
||||
if self.attach_packing_list and delivery and _customer_wants('x_fc_send_packing_slip'):
|
||||
att = _render_report(
|
||||
'fusion_plating_reports.action_report_fp_packing_slip_delivery_portrait', delivery,
|
||||
)
|
||||
if att:
|
||||
ids.append(att)
|
||||
# BoL — gated by customer preference (default False)
|
||||
# BoL - gated by customer preference (default False)
|
||||
if self.attach_bol and delivery and _customer_wants('x_fc_send_bol', default=False):
|
||||
att = _render_report(
|
||||
'fusion_plating_reports.action_report_fp_bol_portrait', delivery,
|
||||
|
||||
Reference in New Issue
Block a user