Skip to content

Commit

Permalink
fix: update closing dates on validate
Browse files Browse the repository at this point in the history
(cherry picked from commit d0231c8)
  • Loading branch information
ruchamahabal authored and mergify[bot] committed Dec 12, 2023
1 parent 5b548b1 commit a6c28bc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions hrms/hr/doctype/job_opening/job_opening.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ def validate(self):
self.route = (
f"jobs/{frappe.scrub(self.company)}/{frappe.scrub(self.job_title).replace('_', '-')}"
)
self.update_closing_date()
self.validate_dates()
self.validate_current_vacancies()
self.update_job_requisition_status()

def on_update(self):
self.update_job_requisition_status()

def update_closing_date(self):
old_doc = self.get_doc_before_save()
if not old_doc:
return

if old_doc.status == "Open" and self.status == "Closed":
today = getdate()
self.closes_on = None
if not self.closed_on:
self.closed_on = today
self.save()
self.closed_on = getdate()

elif old_doc.status == "Closed" and self.status == "Open":
self.closed_on = None
self.save()

def validate_dates(self):
if self.status == "Open":
Expand Down

0 comments on commit a6c28bc

Please sign in to comment.