# -*- 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 AccountPayment(models.Model): _inherit = 'account.payment' def action_post(self): res = super().action_post() Dispatch = self.env['fp.notification.template'] for pay in self: # Only customer receipts (inbound payments from customers) if pay.payment_type != 'inbound' or not pay.partner_id: continue if pay.partner_type != 'customer': continue so = False inv = pay.reconciled_invoice_ids[:1] if inv and inv.invoice_origin: so = self.env['sale.order'].search( [('name', '=', inv.invoice_origin)], limit=1, ) Dispatch._dispatch( 'payment_received', pay, pay.partner_id, sale_order=so, ) return res