# -*- 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 FpDelivery(models.Model): _inherit = 'fusion.plating.delivery' def action_mark_delivered(self): res = super().action_mark_delivered() Dispatch = self.env['fp.notification.template'] Job = self.env.get('fp.job') for rec in self: if not rec.partner_id: continue so = False # Native: fp.job direct link. if Job is not None and 'x_fc_job_id' in rec._fields and rec.x_fc_job_id: so = rec.x_fc_job_id.sale_order_id or False elif Job is not None and rec.job_ref: job = Job.search([('name', '=', rec.job_ref)], limit=1) if job: so = job.sale_order_id or False # Sub 6 — pass the delivery address so location-scoped # contacts receive the 'shipped' notification. Dispatch._dispatch( 'shipped', rec, rec.partner_id, sale_order=so, delivery_location=rec.delivery_address_id or False, ) return res