fix: use db_set in email_campaign (backport #45679) (#48806)

Bug fix in email_campaign's update_status function. (#45679)

During the scheduler event of set_email_campaign_status, the function calling update_status isn't saving the modified status field.

(cherry picked from commit 88e68bb803)

Co-authored-by: harshpwctech <84438948+harshpwctech@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2025-07-28 17:26:17 +05:30
committed by GitHub
parent 442fede0fe
commit 9b59fb659b

View File

@@ -78,11 +78,11 @@ class EmailCampaign(Document):
end_date = getdate(self.end_date)
today_date = getdate(today())
if start_date > today_date:
self.status = "Scheduled"
self.db_set("status", "Scheduled", update_modified=False)
elif end_date >= today_date:
self.status = "In Progress"
self.db_set("status", "In Progress", update_modified=False)
elif end_date < today_date:
self.status = "Completed"
self.db_set("status", "Completed", update_modified=False)
# called through hooks to send campaign mails to leads