diff --git a/hrms/api/roster.py b/hrms/api/roster.py index 3ea5912ffb..fa26bc4ef6 100644 --- a/hrms/api/roster.py +++ b/hrms/api/roster.py @@ -8,6 +8,11 @@ from hrms.hr.doctype.shift_assignment_tool.shift_assignment_tool import create_shift_assignment +@frappe.whitelist() +def get_default_company() -> str: + return frappe.defaults.get_user_default("Company") + + @frappe.whitelist() def get_values(doctype: str, name: str, fields: list) -> dict[str, str]: return frappe.db.get_value(doctype, name, fields, as_dict=True) diff --git a/roster/src/components/MonthViewHeader.vue b/roster/src/components/MonthViewHeader.vue index 872e1145e5..41b2a38068 100644 --- a/roster/src/components/MonthViewHeader.vue +++ b/roster/src/components/MonthViewHeader.vue @@ -38,7 +38,7 @@ diff --git a/roster/src/views/MonthView.vue b/roster/src/views/MonthView.vue index 9debea71ca..06c9061720 100644 --- a/roster/src/views/MonthView.vue +++ b/roster/src/views/MonthView.vue @@ -28,12 +28,14 @@ @addToMonth="addToMonth" /> +
Please select a company.
>(); +const isCompanySelected = ref(false); const showShiftAssignmentDialog = ref(false); const firstOfMonth = ref(dayjs().date(1).startOf("D")); const shiftTypeFilter = ref(""); @@ -73,6 +76,8 @@ const addToMonth = (change: number) => { }; const updateFilters = (newFilters: EmployeeFilters & { shift_type: string }) => { + isCompanySelected.value = !!newFilters.company; + if (!isCompanySelected.value) return; let employeeUpdated = false; (Object.entries(newFilters) as [keyof EmployeeFilters | "shift_type", string][]).forEach( ([key, value]) => { @@ -95,7 +100,7 @@ const employees = createListResource({ doctype: "Employee", fields: ["name", "employee_name", "designation", "image"], filters: employeeFilters, - auto: true, + pageLength: 99999, onError(error: { messages: string[] }) { raiseToast("error", error.messages[0]); },