mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 11:39:18 +00:00
fix: changes Requested
This commit is contained in:
@@ -48,7 +48,7 @@ def get_approvers(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
field_name = "Expense Approver"
|
field_name = "Expense Approver"
|
||||||
elif filters.get("doctype") == "Shift Request":
|
elif filters.get("doctype") == "Shift Request":
|
||||||
parentfield = "shift_request_approver"
|
parentfield = "shift_request_approver"
|
||||||
field_name = "Approver"
|
field_name = "Shift Request Approver"
|
||||||
if department_list:
|
if department_list:
|
||||||
for d in department_list:
|
for d in department_list:
|
||||||
approvers += frappe.db.sql("""select user.name, user.first_name, user.last_name from
|
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
|
select name, shift_type, start_date ,end_date, docstatus, status
|
||||||
from `tabShift Assignment`
|
from `tabShift Assignment`
|
||||||
where
|
where
|
||||||
employee=%(employee)s and docstatus < 2
|
employee=%(employee)s and docstatus = 1
|
||||||
and name != %(name)s
|
and name != %(name)s
|
||||||
and status = "Active"
|
and status = "Active"
|
||||||
{0}
|
{0}
|
||||||
@@ -53,14 +53,11 @@ class ShiftAssignment(Document):
|
|||||||
"name": self.name
|
"name": self.name
|
||||||
}, as_dict = 1)
|
}, as_dict = 1)
|
||||||
|
|
||||||
for shift in assigned_shifts:
|
if len(assigned_shifts):
|
||||||
if shift.name:
|
self.throw_overlap_error(assigned_shifts[0])
|
||||||
self.throw_overlap_error(shift)
|
|
||||||
|
|
||||||
def throw_overlap_error(self, shift_details):
|
def throw_overlap_error(self, shift_details):
|
||||||
shift_details = frappe._dict(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":
|
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))
|
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:
|
if shift_details.start_date:
|
||||||
|
|||||||
@@ -78,8 +78,10 @@ class ShiftType(Document):
|
|||||||
if shift_details and shift_details.shift_type.name == self.name:
|
if shift_details and shift_details.shift_type.name == self.name:
|
||||||
mark_attendance(employee, date, 'Absent', self.name)
|
mark_attendance(employee, date, 'Absent', self.name)
|
||||||
|
|
||||||
def get_assigned_employee(self, consider_default_shift=False):
|
def get_assigned_employee(self, from_date=None, consider_default_shift=False):
|
||||||
filters = {'shift_type': self.name, 'docstatus': '1'}
|
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 = frappe.get_all('Shift Assignment', 'employee', filters, as_list=True)
|
||||||
assigned_employees = [x[0] for x in assigned_employees]
|
assigned_employees = [x[0] for x in assigned_employees]
|
||||||
|
|||||||
Reference in New Issue
Block a user