send email on update and on update after submit fixes #8898
This commit is contained in:
parent
24173b9a12
commit
9936100a6a
@ -8,20 +8,19 @@ from frappe import _
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class TrainingEvent(Document):
|
class TrainingEvent(Document):
|
||||||
def validate(self):
|
def on_update(self):
|
||||||
if self.event_status == "Scheduled":
|
self.invite_employee()
|
||||||
self.invite_employee()
|
|
||||||
|
|
||||||
def on_update_after_submit(self):
|
def on_update_after_submit(self):
|
||||||
if self.event_status == "Scheduled" and self.send_email:
|
self.invite_employee()
|
||||||
self.invite_employee()
|
|
||||||
|
|
||||||
def invite_employee(self):
|
def invite_employee(self):
|
||||||
subject = _("""You are invited for to attend {0} - {1} scheduled from {2} to {3} at {4}."""\
|
if self.event_status == "Scheduled" and self.send_email:
|
||||||
.format(self.type, self.event_name, self.start_time, self.end_time, self.location))
|
subject = _("""You are invited for to attend {0} - {1} scheduled from {2} to {3} at {4}."""\
|
||||||
|
.format(self.type, self.event_name, self.start_time, self.end_time, self.location))
|
||||||
for emp in self.employees:
|
|
||||||
if emp.status== "Open":
|
for emp in self.employees:
|
||||||
frappe.sendmail(frappe.db.get_value("Employee", emp.employee, "company_email"), \
|
if emp.status== "Open":
|
||||||
subject=subject, content= self.introduction)
|
frappe.sendmail(frappe.db.get_value("Employee", emp.employee, "company_email"), \
|
||||||
emp.status= "Invited"
|
subject=subject, content= self.introduction)
|
||||||
|
emp.status= "Invited"
|
Loading…
Reference in New Issue
Block a user