Skip to content

Commit

Permalink
feat: add scheduler event to close expired job openings
Browse files Browse the repository at this point in the history
(cherry picked from commit 63efc2f)
  • Loading branch information
krantheman authored and mergify[bot] committed Dec 12, 2023
1 parent 88f6422 commit 78299f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions hrms/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
"hrms.controllers.employee_reminders.send_work_anniversary_reminders",
"hrms.hr.doctype.daily_work_summary_group.daily_work_summary_group.send_summary",
"hrms.hr.doctype.interview.interview.send_daily_feedback_reminder",
"hrms.hr.doctype.job_opening.job_opening.close_expired_job_openings",
],
"daily_long": [
"hrms.hr.doctype.leave_ledger_entry.leave_ledger_entry.process_expired_allocation",
Expand Down
10 changes: 10 additions & 0 deletions hrms/hr/doctype/job_opening/job_opening.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,13 @@ def get_job_openings(
return frappe.get_all(
doctype, filters, fields, start=limit_start, page_length=limit_page_length, order_by=order_by
)


def close_expired_job_openings():
today = getdate()
for d in frappe.get_all(
"Job Opening",
filters={"Status": "Open", "closes_on": ["<=", today]},
fields=["name", "closes_on"],
):
frappe.set_value("Job Opening", d.name, "status", "Closed")

0 comments on commit 78299f1

Please sign in to comment.