Hello Odoo-Users,
i want to modify the Helpdesk Modul so that it will send a notification email to the leaders in charge of the client automatically when a new ticket was created. This is my code in the addon at the moment :
helpdesk_addon.py :
from odoo import fields, models, api
from odoo import exceptions
class HelpdeskAddon(models.Model):
_inherit = 'helpdesk.ticket'
display_name = fields.Char()
test_field = fields.Char()
ticket_type_id = fields.Many2one(
'helpdesk.ticket.type', default=lambda self: self.env['helpdesk.ticket.type'].search([('name', '=', 'E-Mail')]))
@api.model
def create(self, vals):
res = self.env['res.partner'].search([('id', '=', vals['partner_id'])])
# ----------------------------
temp_id = self.env.ref(
'helpdesk_addon.new_ticket_created_mail_template')
list = []
for var in res:
if var.overall_lead_mycompany:
list.append(var.overall_lead_mycompany.work_email)
if var.overall_deputy_mycompany:
list.append(var.overall_deputy_mycompany.work_email)
if var.technical_lead_mycompany:
list.append(var.technical_lead_mycompany.work_email)
if var.technical_deputy_mycompany:
list.append(var.technical_deputy_mycompany.work_email)
vals['description'] = list
temp_id.email_to(list) # i want to insert email through the list to
temp_id.send_mail(self.id, force_send=True)
return super(HelpdeskAddon, self).create(vals)
I have no idea how to modify email_to so it will send an email to the adresses in my list[].
I tested the outgoing server and its working fine.
Thank you for ur responds!