1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/industry_fsm_sale/wizard/sale_make_invoice_advance.py
2024-12-10 09:04:09 +07:00

20 lines
816 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
class SaleAdvancePaymentInv(models.TransientModel):
_inherit = 'sale.advance.payment.inv'
def _create_invoices(self, sale_orders):
invoices = super()._create_invoices(sale_orders)
so_task_mapping = self._context.get('industry_fsm_message_post_task_id')
if so_task_mapping:
for invoice in invoices:
for so in invoice.line_ids.sale_line_ids.order_id:
for task_id in so_task_mapping[str(so.id)]:
message = _("An invoice has been created: %s", invoice._get_html_link())
self.env['project.task'].browse(task_id).message_post(body=message)
return invoices