hi all i have model called crm.lead.extended, i want to trigger mail notification when a record is created in that , how to do that? i want this to be done by code
i have created some sample functions for that someone check and confirm this because iam not getting any mails when i create a record
@ api.model
def create (self, vals):
rec = super (crm_extended, self) .create (vals)
if 'opportunity_id' in vals:
template = self.env.ref ('crm_extended.create_crm_lead_mail_template')
for rec in self:
template.send_mail (rec.id, force_send = True)
return rec
@ api.model
def create (self, vals):
vals ['usage'] = 'crm.lead.extended'
crm.lead.extended = super (crm_extended, self) .create (vals)
self._update_cron ()
self._update_registry ()
return crm.lead.extended
Send email on some event: https://goo.gl/z16PBZ