# -*- 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 AccountMove(models.Model): _inherit = 'account.move' def action_post(self): res = super().action_post() Dispatch = self.env['fp.notification.template'] for move in self: if move.move_type != 'out_invoice' or not move.partner_id: continue so = False if move.invoice_origin: so = self.env['sale.order'].search( [('name', '=', move.invoice_origin)], limit=1, ) Dispatch._dispatch( 'invoice_posted', move, move.partner_id, sale_order=so, ) return res