fix: changes Requested
This commit is contained in:
parent
00a8081aba
commit
74f0a1ab7c
@ -48,7 +48,7 @@ def get_approvers(doctype, txt, searchfield, start, page_len, filters):
|
||||
field_name = "Expense Approver"
|
||||
elif filters.get("doctype") == "Shift Request":
|
||||
parentfield = "shift_request_approver"
|
||||
field_name = "Approver"
|
||||
field_name = "Shift Request Approver"
|
||||
if department_list:
|
||||
for d in department_list:
|
||||
approvers += frappe.db.sql("""select user.name, user.first_name, user.last_name from
|
||||
|
@ -41,7 +41,7 @@ class ShiftAssignment(Document):
|
||||
select name, shift_type, start_date ,end_date, docstatus, status
|
||||
from `tabShift Assignment`
|
||||
where
|
||||
employee=%(employee)s and docstatus < 2
|
||||
employee=%(employee)s and docstatus = 1
|
||||
and name != %(name)s
|
||||
and status = "Active"
|
||||
{0}
|
||||
@ -53,14 +53,11 @@ class ShiftAssignment(Document):
|
||||
"name": self.name
|
||||
}, as_dict = 1)
|
||||
|
||||
for shift in assigned_shifts:
|
||||
if shift.name:
|
||||
self.throw_overlap_error(shift)
|
||||
if len(assigned_shifts):
|
||||
self.throw_overlap_error(assigned_shifts[0])
|
||||
|
||||
def throw_overlap_error(self, shift_details):
|
||||
shift_details = frappe._dict(shift_details)
|
||||
if shift_details.docstatus == 0:
|
||||
msg = _("Employee {0} has already applied for {1}: {2}").format(frappe.bold(self.employee), frappe.bold(self.shift_type), frappe.bold(shift_details.name))
|
||||
if shift_details.docstatus == 1 and shift_details.status == "Active":
|
||||
msg = _("Employee {0} already has Active Shift {1}: {2}").format(frappe.bold(self.employee), frappe.bold(self.shift_type), frappe.bold(shift_details.name))
|
||||
if shift_details.start_date:
|
||||
|
@ -78,8 +78,10 @@ class ShiftType(Document):
|
||||
if shift_details and shift_details.shift_type.name == self.name:
|
||||
mark_attendance(employee, date, 'Absent', self.name)
|
||||
|
||||
def get_assigned_employee(self, consider_default_shift=False):
|
||||
filters = {'shift_type': self.name, 'docstatus': '1'}
|
||||
def get_assigned_employee(self, from_date=None, consider_default_shift=False):
|
||||
filters = {'start_date':('>', from_date), 'shift_type': self.name, 'docstatus': '1'}
|
||||
if not from_date:
|
||||
del filters["start_date"]
|
||||
|
||||
assigned_employees = frappe.get_all('Shift Assignment', 'employee', filters, as_list=True)
|
||||
assigned_employees = [x[0] for x in assigned_employees]
|
||||
|
Loading…
x
Reference in New Issue
Block a user