Update and set status on the basis of project completion

This commit is contained in:
Shreya
2018-06-20 15:48:27 +05:30
parent a5afd96019
commit 5c6ade4bd8
4 changed files with 41 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ class EmployeeBoardingController(Document):
"company": self.company
}).insert(ignore_permissions=True)
self.db_set("project", project.name)
self.db_set("boarding_status", "Pending")
# create the task for the given project and assign to the concerned person
for activity in self.activities:
@@ -84,6 +85,17 @@ def get_onboarding_details(parent, parenttype):
filters={"parent": parent, "parenttype": parenttype},
order_by= "idx")
@frappe.whitelist()
def get_boarding_status(project):
status = 'Pending'
if project:
doc = frappe.get_doc('Project', project)
if flt(doc.percent_complete) > 0.0 and flt(doc.percent_complete) < 100.0:
status = 'In Process'
elif flt(doc.percent_complete) == 100.0:
status = 'Completed'
return status
def set_employee_name(doc):
if doc.employee and not doc.employee_name:
doc.employee_name = frappe.db.get_value("Employee", doc.employee, "employee_name")