Files
Odoo-Modules/fusion_plating/fusion_plating_invoicing/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

43 lines
1.4 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.
import logging
from odoo import models
_logger = logging.getLogger(__name__)
class FpDelivery(models.Model):
"""Fire the 'final balance' invoice for Progress Billing / Net Terms
when a delivery is marked delivered.
"""
_inherit = 'fusion.plating.delivery'
def action_mark_delivered(self):
res = super().action_mark_delivered()
SaleOrder = self.env['sale.order']
# Sub 11 - MRP gone; resolve via delivery.job_ref → fp.job.name → fp.job.origin.
Job = self.env['fp.job'] if 'fp.job' in self.env else None
for delivery in self:
so = False
if delivery.job_ref and Job is not None:
job = Job.sudo().search(
[('name', '=', delivery.job_ref)], limit=1,
)
if job and job.origin:
so = SaleOrder.search(
[('name', '=', job.origin)], limit=1,
)
if not so:
continue
strategy = so.x_fc_invoice_strategy
if strategy not in ('progress', 'net_terms'):
continue
if so.invoice_status == 'invoiced':
continue
so._create_final_balance_invoice()
return res