fix: requested changes
This commit is contained in:
parent
17e6d0918b
commit
3aa1101d5e
@ -46,7 +46,7 @@ def get_approvers(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
elif filters.get("doctype") == "Leave Application":
|
elif filters.get("doctype") == "Leave Application":
|
||||||
parentfield = "expense_approvers"
|
parentfield = "expense_approvers"
|
||||||
field_name = "Expense Approver"
|
field_name = "Expense Approver"
|
||||||
else:
|
elif filters.get("doctype") == "Shift Request":
|
||||||
parentfield = "shift_request_approver"
|
parentfield = "shift_request_approver"
|
||||||
field_name = "Approver"
|
field_name = "Approver"
|
||||||
if department_list:
|
if department_list:
|
||||||
|
@ -16,7 +16,7 @@ class ShiftAssignment(Document):
|
|||||||
self.validate_overlapping_dates()
|
self.validate_overlapping_dates()
|
||||||
|
|
||||||
if self.end_date and self.end_date <= self.start_date:
|
if self.end_date and self.end_date <= self.start_date:
|
||||||
frappe.throw(_("End Date should not be less than Start Date"))
|
frappe.throw(_("End Date must not be greater than Start Date"))
|
||||||
|
|
||||||
def validate_overlapping_dates(self):
|
def validate_overlapping_dates(self):
|
||||||
if not self.name:
|
if not self.name:
|
||||||
@ -62,7 +62,7 @@ class ShiftAssignment(Document):
|
|||||||
if shift_details.docstatus == 0:
|
if shift_details.docstatus == 0:
|
||||||
msg = _("Employee {0} has already applied for {1}: {2}").format(self.employee, self.shift_type, shift_details.name)
|
msg = _("Employee {0} has already applied for {1}: {2}").format(self.employee, self.shift_type, shift_details.name)
|
||||||
if shift_details.docstatus == 1 and shift_details.status == "Active":
|
if shift_details.docstatus == 1 and shift_details.status == "Active":
|
||||||
msg = _("Employee {0} already have Active Shift {1}: {2}").format(self.employee, self.shift_type, shift_details.name)
|
msg = _("Employee {0} already has Active Shift {1}: {2}").format(self.employee, self.shift_type, shift_details.name)
|
||||||
if shift_details.start_date:
|
if shift_details.start_date:
|
||||||
msg += _(" from {0}").format(getdate(self.start_date).strftime("%d-%m-%Y"))
|
msg += _(" from {0}").format(getdate(self.start_date).strftime("%d-%m-%Y"))
|
||||||
if shift_details.end_date:
|
if shift_details.end_date:
|
||||||
|
@ -79,7 +79,7 @@ class ShiftType(Document):
|
|||||||
mark_attendance(employee, date, 'Absent', self.name)
|
mark_attendance(employee, date, 'Absent', self.name)
|
||||||
|
|
||||||
def get_assigned_employee(self, from_date=None, consider_default_shift=False):
|
def get_assigned_employee(self, from_date=None, consider_default_shift=False):
|
||||||
filters = {'date':('>=', from_date), 'shift_type': self.name, 'docstatus': '1'}
|
filters = {'start_date':('>=', from_date), 'shift_type': self.name, 'docstatus': '1'}
|
||||||
if not from_date:
|
if not from_date:
|
||||||
del filters['date']
|
del filters['date']
|
||||||
assigned_employees = frappe.get_all('Shift Assignment', 'employee', filters, as_list=True)
|
assigned_employees = frappe.get_all('Shift Assignment', 'employee', filters, as_list=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user