This commit is contained in:
gsinghpal
2026-05-10 10:25:12 -04:00
parent 6c6a59ceef
commit 6b7b44264a
59 changed files with 2461 additions and 324 deletions

View File

@@ -5,7 +5,7 @@
{
'name': 'Fusion Plating — Notifications',
'version': '19.0.6.3.0',
'version': '19.0.6.4.0',
'category': 'Manufacturing/Plating',
'summary': 'Auto-email notifications at workflow milestones with configurable templates, PDF attachments, and audit log.',
'author': 'Nexa Systems Inc.',

View File

@@ -9,6 +9,7 @@ from . import res_partner
from . import sale_order
from . import fp_receiving
from . import account_move
from . import account_move_send
from . import account_payment
# Phase 5 (Sub 11) — mrp.production hook retired. The native equivalent
# fires from fp.job.button_mark_done -> _fp_fire_notification('job_complete').

View File

@@ -0,0 +1,50 @@
# -*- 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)