This commit is contained in:
gsinghpal
2026-04-27 00:11:18 -04:00
parent d9f58b9851
commit f08f328688
116 changed files with 9891 additions and 359 deletions

View File

@@ -5,7 +5,7 @@
{
'name': 'Fusion Plating — Notifications',
'version': '19.0.6.0.0',
'version': '19.0.6.2.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

@@ -13,11 +13,16 @@ TRIGGER_EVENTS = [
('quote_sent', 'Quotation Sent'),
('so_confirmed', 'Order Confirmed'),
('parts_received', 'Parts Received'),
('mo_complete', 'Manufacturing Complete'),
('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
('shipped', 'Shipped / Delivered'),
('invoice_posted', 'Invoice Posted'),
('payment_received', 'Payment Received'),
('deposit_created', 'Deposit Required'),
('rma_authorised', 'RMA Authorised'), # Sub 12 — RMA lifecycle
('rma_received', 'RMA Parts Received'),
('rma_resolved', 'RMA Resolved'),
]
# Sub 6 — map each trigger event to a communication stream. Contacts on
@@ -29,10 +34,15 @@ FP_TRIGGER_STREAM = {
'so_confirmed': 'quotes_so',
'parts_received': 'quotes_so',
'mo_complete': 'qc',
'job_confirmed': 'qc',
'job_complete': 'qc',
'shipped': 'certs',
'invoice_posted': 'invoices',
'payment_received': 'invoices',
'deposit_created': 'invoices',
'rma_authorised': 'qc',
'rma_received': 'qc',
'rma_resolved': 'qc',
}
@@ -117,6 +127,9 @@ class FpNotificationTemplate(models.Model):
)
elif partner.email:
recipient_emails = [partner.email]
# 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)
email_values = {}

View File

@@ -1,31 +0,0 @@
# -*- 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 models
class MrpProduction(models.Model):
_inherit = 'mrp.production'
def button_mark_done(self):
res = super().button_mark_done()
Dispatch = self.env['fp.notification.template']
for mo in self:
partner = False
so = False
if mo.x_fc_portal_job_id:
partner = mo.x_fc_portal_job_id.partner_id
if mo.origin:
so = self.env['sale.order'].search(
[('name', '=', mo.origin)], limit=1,
)
if so and not partner:
partner = so.partner_id
if not partner:
continue
Dispatch._dispatch(
'mo_complete', mo, partner, sale_order=so,
)
return res