Files
Odoo-Modules/fusion_plating/fusion_plating_bridge_mrp/models/fp_delivery.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.1 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 _, fields, models
from odoo.exceptions import UserError
class FpDelivery(models.Model):
"""Extend delivery to auto-update portal job and block shipment
when hydrogen embrittlement bake window isn't closed.
"""
_inherit = 'fusion.plating.delivery'
def action_mark_delivered(self):
"""Override to cascade delivery completion to the portal job and
enforce the bake-window lockout."""
# --- Lockout: refuse to ship if any bake window for this job isn't complete
BakeWindow = self.env.get('fusion.plating.bake.window')
if BakeWindow is not None:
for delivery in self:
if not delivery.job_ref:
continue
open_windows = BakeWindow.search([
('lot_ref', '=', delivery.job_ref),
('state', 'not in', ('baked', 'scrapped')),
])
if open_windows:
bad = open_windows[0]
raise UserError(_(
'Cannot mark delivery %s delivered - job %s has an open '
'bake window (%s, state: %s). Complete the relief bake '
'or mark it scrapped before shipping.'
) % (delivery.name, delivery.job_ref, bad.name, bad.state))
res = super().action_mark_delivered()
PortalJob = self.env['fusion.plating.portal.job']
for delivery in self:
if not delivery.job_ref:
continue
job = PortalJob.search([('name', '=', delivery.job_ref)], limit=1)
if not job:
continue
job.write({
'state': 'shipped',
'actual_ship_date': fields.Date.today(),
'tracking_ref': delivery.name,
})
job.message_post(body=_('Parts shipped - delivery %s marked delivered.') % delivery.name)
return res