Skip to content

Commit

Permalink
refactor(Shift Assignment Schedule): change Status to Enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
krantheman committed Jun 27, 2024
1 parent 606e579 commit 65782df
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion hrms/api/roster.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def create_shift_assignment_schedule(
"doctype": "Shift Assignment Schedule",
"frequency": frequency,
"repeat_on_days": [{"day": day} for day in repeat_on_days],
"status": "Inactive" if end_date else "Active",
"enabled": 0 if end_date else 1,
"employee": employee,
"company": company,
"shift_type": shift_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"frequency",
"repeat_on_days",
"column_break_iprq",
"status",
"enabled",
"create_shifts_after",
"shift_details_section",
"employee",
Expand All @@ -32,17 +32,6 @@
"options": "Every Week\nEvery 2 Weeks\nEvery 3 Weeks\nEvery 4 Weeks",
"reqd": 1
},
{
"default": "Active",
"description": "Select 'Active' if you want new shift assignments to be created automatically.",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Status",
"options": "Active\nInactive",
"reqd": 1
},
{
"fieldname": "shift_details_section",
"fieldtype": "Section Break",
Expand All @@ -57,10 +46,12 @@
"reqd": 1
},
{
"fetch_from": "employee.company",
"fieldname": "company",
"fieldtype": "Link",
"label": "Company",
"options": "Company",
"read_only": 1,
"reqd": 1
},
{
Expand All @@ -76,12 +67,6 @@
"options": "Shift Type",
"reqd": 1
},
{
"fieldname": "shift_status",
"fieldtype": "Select",
"label": "Shift Status",
"options": "Active\nInactive"
},
{
"fieldname": "schedule_settings_section",
"fieldtype": "Section Break"
Expand All @@ -95,7 +80,7 @@
},
{
"default": "Today",
"depends_on": "eval:doc.status === 'Active'",
"depends_on": "eval:doc.enabled",
"description": "New shift assignments will be created after this date.",
"fieldname": "create_shifts_after",
"fieldtype": "Date",
Expand All @@ -108,6 +93,20 @@
"label": "Repeat On Days",
"options": "Assignment Rule Day",
"reqd": 1
},
{
"default": "1",
"description": "Select this if you want shift assignments to be automatically created indefinitely.",
"fieldname": "enabled",
"fieldtype": "Check",
"label": "Enabled"
},
{
"default": "Active",
"fieldname": "shift_status",
"fieldtype": "Select",
"label": "Status",
"options": "Active\nInactive"
}
],
"index_web_pages_for_search": 1,
Expand All @@ -117,7 +116,7 @@
"link_fieldname": "schedule"
}
],
"modified": "2024-06-25 16:49:16.848569",
"modified": "2024-06-27 14:37:31.797684",
"modified_by": "Administrator",
"module": "HR",
"name": "Shift Assignment Schedule",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_individual_assignment(self, start_date, end_date):
def process_auto_shift_creation():
schedules = frappe.get_all(
"Shift Assignment Schedule",
filters={"status": "Active", "create_shifts_after": ["<=", nowdate()]},
filters={"enabled": 1, "create_shifts_after": ["<=", nowdate()]},
pluck="name",
)
for d in schedules:
Expand Down

0 comments on commit 65782df

Please sign in to comment.