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

51 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 api, models
class AccountMoveSend(models.AbstractModel):
_inherit = 'account.move.send'
@api.model
def _get_default_pdf_report_id(self, move):
"""Make the Fusion Plating invoice the official invoice PDF.
Odoo's Send wizard renders the chosen ``pdf_report`` as the
legal/audit-trail PDF (stored on ``move.invoice_pdf_report_id``)
and ALSO renders every extra report listed in the mail
template's ``report_template_ids`` minus the chosen pdf_report
and ``account.account_invoices`` (see
``_get_placeholder_mail_template_dynamic_attachments_data``).
Without this override the wizard picks ``account.account_invoices``
as the official PDF, so the email ships TWO invoices: the stock
Odoo one + our branded plating one (which is in our mail
template's ``report_template_ids``). Returning our report as the
default makes the set-difference cancel out and the customer
receives a single, branded invoice.
Partner-level and journal-level ``invoice_template_pdf_report_id``
overrides still win - admins can opt out per customer or journal.
"""
partner_default = move.commercial_partner_id.with_company(
move.company_id
).invoice_template_pdf_report_id
if partner_default:
return partner_default
journal_default = move.journal_id.with_company(
move.company_id
).invoice_template_pdf_report_id
if journal_default:
return journal_default
if move.move_type == 'out_invoice':
fp_report = self.env.ref(
'fusion_plating_reports.action_report_fp_invoice_portrait',
raise_if_not_found=False,
)
if fp_report and move._is_action_report_available(fp_report):
return fp_report
return super()._get_default_pdf_report_id(move)