hi
I want know, how send automatic email when a form's state is change?
I search and one page find that someone had given such a solution:
---------------------------------------------
@api.onchange('state')
@api.one
def email_onchange_state(self):
if self.state == 'done':
tmplt_id = self.env['mail.template'].search([("name", "=", "my_temp_onchange_state_to_done")]) # (I create "my_temp_onchange_state_to_done" template email)
if tmplt_id:
self.env['mail.template'].browse(tmplt_id.id).send_mail(self.id, force_send=True)
--------------------------------------------
but when I test , it does not work.( without error)
do you have a solution?
Check how to send email on some event: https://goo.gl/z16PBZ