diff --git a/frontend/index.html b/frontend/index.html index 9682e3b7b0..1e1e86823a 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -184,6 +184,7 @@ diff --git a/frontend/src/assets/Inter/Inter-Black.woff b/frontend/src/assets/Inter/Inter-Black.woff deleted file mode 100644 index c7737ed3d8..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Black.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Black.woff2 b/frontend/src/assets/Inter/Inter-Black.woff2 deleted file mode 100644 index b16b995bee..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Black.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-BlackItalic.woff b/frontend/src/assets/Inter/Inter-BlackItalic.woff deleted file mode 100644 index b5f1447643..0000000000 Binary files a/frontend/src/assets/Inter/Inter-BlackItalic.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-BlackItalic.woff2 b/frontend/src/assets/Inter/Inter-BlackItalic.woff2 deleted file mode 100644 index a3f1b70cdf..0000000000 Binary files a/frontend/src/assets/Inter/Inter-BlackItalic.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Bold.woff b/frontend/src/assets/Inter/Inter-Bold.woff deleted file mode 100644 index e38455587f..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Bold.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Bold.woff2 b/frontend/src/assets/Inter/Inter-Bold.woff2 deleted file mode 100644 index 835dd4977a..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Bold.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-BoldItalic.woff b/frontend/src/assets/Inter/Inter-BoldItalic.woff deleted file mode 100644 index ffac3f59b5..0000000000 Binary files a/frontend/src/assets/Inter/Inter-BoldItalic.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-BoldItalic.woff2 b/frontend/src/assets/Inter/Inter-BoldItalic.woff2 deleted file mode 100644 index 1a41a14ff1..0000000000 Binary files a/frontend/src/assets/Inter/Inter-BoldItalic.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ExtraBold.woff b/frontend/src/assets/Inter/Inter-ExtraBold.woff deleted file mode 100644 index 885ac94fbf..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ExtraBold.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ExtraBold.woff2 b/frontend/src/assets/Inter/Inter-ExtraBold.woff2 deleted file mode 100644 index ae956b1501..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ExtraBold.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ExtraBoldItalic.woff b/frontend/src/assets/Inter/Inter-ExtraBoldItalic.woff deleted file mode 100644 index d6cf862332..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ExtraBoldItalic.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ExtraBoldItalic.woff2 b/frontend/src/assets/Inter/Inter-ExtraBoldItalic.woff2 deleted file mode 100644 index 86578995d2..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ExtraBoldItalic.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ExtraLight.woff b/frontend/src/assets/Inter/Inter-ExtraLight.woff deleted file mode 100644 index ff76919327..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ExtraLight.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ExtraLight.woff2 b/frontend/src/assets/Inter/Inter-ExtraLight.woff2 deleted file mode 100644 index 694b2df9fa..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ExtraLight.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ExtraLightItalic.woff b/frontend/src/assets/Inter/Inter-ExtraLightItalic.woff deleted file mode 100644 index c6ed13a4ff..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ExtraLightItalic.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ExtraLightItalic.woff2 b/frontend/src/assets/Inter/Inter-ExtraLightItalic.woff2 deleted file mode 100644 index 9a7bd11090..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ExtraLightItalic.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Italic.woff b/frontend/src/assets/Inter/Inter-Italic.woff deleted file mode 100644 index 4fdb59dc2d..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Italic.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Italic.woff2 b/frontend/src/assets/Inter/Inter-Italic.woff2 deleted file mode 100644 index deca637d81..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Italic.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Light.woff b/frontend/src/assets/Inter/Inter-Light.woff deleted file mode 100644 index 42850acc03..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Light.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Light.woff2 b/frontend/src/assets/Inter/Inter-Light.woff2 deleted file mode 100644 index 65a7dadddb..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Light.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-LightItalic.woff b/frontend/src/assets/Inter/Inter-LightItalic.woff deleted file mode 100644 index c4ed9a94fa..0000000000 Binary files a/frontend/src/assets/Inter/Inter-LightItalic.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-LightItalic.woff2 b/frontend/src/assets/Inter/Inter-LightItalic.woff2 deleted file mode 100644 index 555fc55955..0000000000 Binary files a/frontend/src/assets/Inter/Inter-LightItalic.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Medium.woff b/frontend/src/assets/Inter/Inter-Medium.woff deleted file mode 100644 index 495faef7ff..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Medium.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Medium.woff2 b/frontend/src/assets/Inter/Inter-Medium.woff2 deleted file mode 100644 index 871ce4ce5d..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Medium.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-MediumItalic.woff b/frontend/src/assets/Inter/Inter-MediumItalic.woff deleted file mode 100644 index 389c7a2bfe..0000000000 Binary files a/frontend/src/assets/Inter/Inter-MediumItalic.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-MediumItalic.woff2 b/frontend/src/assets/Inter/Inter-MediumItalic.woff2 deleted file mode 100644 index aa8057992b..0000000000 Binary files a/frontend/src/assets/Inter/Inter-MediumItalic.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Regular.woff b/frontend/src/assets/Inter/Inter-Regular.woff deleted file mode 100644 index fa7715d120..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Regular.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Regular.woff2 b/frontend/src/assets/Inter/Inter-Regular.woff2 deleted file mode 100644 index b52dd0a0b7..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Regular.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-SemiBold.woff b/frontend/src/assets/Inter/Inter-SemiBold.woff deleted file mode 100644 index 18d7749f56..0000000000 Binary files a/frontend/src/assets/Inter/Inter-SemiBold.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-SemiBold.woff2 b/frontend/src/assets/Inter/Inter-SemiBold.woff2 deleted file mode 100644 index ece5204a19..0000000000 Binary files a/frontend/src/assets/Inter/Inter-SemiBold.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-SemiBoldItalic.woff b/frontend/src/assets/Inter/Inter-SemiBoldItalic.woff deleted file mode 100644 index 8ee64396a0..0000000000 Binary files a/frontend/src/assets/Inter/Inter-SemiBoldItalic.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-SemiBoldItalic.woff2 b/frontend/src/assets/Inter/Inter-SemiBoldItalic.woff2 deleted file mode 100644 index b32c0ba3bd..0000000000 Binary files a/frontend/src/assets/Inter/Inter-SemiBoldItalic.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Thin.woff b/frontend/src/assets/Inter/Inter-Thin.woff deleted file mode 100644 index 1a22286f6e..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Thin.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-Thin.woff2 b/frontend/src/assets/Inter/Inter-Thin.woff2 deleted file mode 100644 index c56bc7ca6d..0000000000 Binary files a/frontend/src/assets/Inter/Inter-Thin.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ThinItalic.woff b/frontend/src/assets/Inter/Inter-ThinItalic.woff deleted file mode 100644 index d8ec8373ac..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ThinItalic.woff and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-ThinItalic.woff2 b/frontend/src/assets/Inter/Inter-ThinItalic.woff2 deleted file mode 100644 index eca5608c0f..0000000000 Binary files a/frontend/src/assets/Inter/Inter-ThinItalic.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-italic.var.woff2 b/frontend/src/assets/Inter/Inter-italic.var.woff2 deleted file mode 100644 index 1f5d92611a..0000000000 Binary files a/frontend/src/assets/Inter/Inter-italic.var.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter-roman.var.woff2 b/frontend/src/assets/Inter/Inter-roman.var.woff2 deleted file mode 100644 index 05621d8d16..0000000000 Binary files a/frontend/src/assets/Inter/Inter-roman.var.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/Inter.var.woff2 b/frontend/src/assets/Inter/Inter.var.woff2 deleted file mode 100644 index 46bb515393..0000000000 Binary files a/frontend/src/assets/Inter/Inter.var.woff2 and /dev/null differ diff --git a/frontend/src/assets/Inter/inter.css b/frontend/src/assets/Inter/inter.css deleted file mode 100644 index 9f8f80f844..0000000000 --- a/frontend/src/assets/Inter/inter.css +++ /dev/null @@ -1,152 +0,0 @@ -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 100; - font-display: swap; - src: url("Inter-Thin.woff2?v=3.12") format("woff2"), - url("Inter-Thin.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 100; - font-display: swap; - src: url("Inter-ThinItalic.woff2?v=3.12") format("woff2"), - url("Inter-ThinItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 200; - font-display: swap; - src: url("Inter-ExtraLight.woff2?v=3.12") format("woff2"), - url("Inter-ExtraLight.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 200; - font-display: swap; - src: url("Inter-ExtraLightItalic.woff2?v=3.12") format("woff2"), - url("Inter-ExtraLightItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 300; - font-display: swap; - src: url("Inter-Light.woff2?v=3.12") format("woff2"), - url("Inter-Light.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 300; - font-display: swap; - src: url("Inter-LightItalic.woff2?v=3.12") format("woff2"), - url("Inter-LightItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url("Inter-Regular.woff2?v=3.12") format("woff2"), - url("Inter-Regular.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 400; - font-display: swap; - src: url("Inter-Italic.woff2?v=3.12") format("woff2"), - url("Inter-Italic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 500; - font-display: swap; - src: url("Inter-Medium.woff2?v=3.12") format("woff2"), - url("Inter-Medium.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 500; - font-display: swap; - src: url("Inter-MediumItalic.woff2?v=3.12") format("woff2"), - url("Inter-MediumItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 600; - font-display: swap; - src: url("Inter-SemiBold.woff2?v=3.12") format("woff2"), - url("Inter-SemiBold.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 600; - font-display: swap; - src: url("Inter-SemiBoldItalic.woff2?v=3.12") format("woff2"), - url("Inter-SemiBoldItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 700; - font-display: swap; - src: url("Inter-Bold.woff2?v=3.12") format("woff2"), - url("Inter-Bold.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 700; - font-display: swap; - src: url("Inter-BoldItalic.woff2?v=3.12") format("woff2"), - url("Inter-BoldItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 800; - font-display: swap; - src: url("Inter-ExtraBold.woff2?v=3.12") format("woff2"), - url("Inter-ExtraBold.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 800; - font-display: swap; - src: url("Inter-ExtraBoldItalic.woff2?v=3.12") format("woff2"), - url("Inter-ExtraBoldItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 900; - font-display: swap; - src: url("Inter-Black.woff2?v=3.12") format("woff2"), - url("Inter-Black.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 900; - font-display: swap; - src: url("Inter-BlackItalic.woff2?v=3.12") format("woff2"), - url("Inter-BlackItalic.woff?v=3.12") format("woff"); -} diff --git a/frontend/src/main.css b/frontend/src/main.css index 4164ae9df3..5f40aba926 100644 --- a/frontend/src/main.css +++ b/frontend/src/main.css @@ -1,4 +1,3 @@ -@import "./assets/Inter/inter.css"; @import "frappe-ui/src/style.css"; ion-modal { diff --git a/frontend/src/socket.js b/frontend/src/socket.js index ea687e6949..a942ea6fc5 100644 --- a/frontend/src/socket.js +++ b/frontend/src/socket.js @@ -6,9 +6,10 @@ import { getCachedResource } from "frappe-ui/src/resources/resources" export function initSocket() { let host = window.location.hostname + let siteName = window.site_name let port = window.location.port ? `:${socketio_port}` : "" let protocol = port ? "http" : "https" - let url = `${protocol}://${host}${port}/${host}` + let url = `${protocol}://${host}${port}/${siteName}` let socket = io(url, { withCredentials: true, reconnectionAttempts: 5, diff --git a/hrms/hr/doctype/leave_allocation/leave_allocation.js b/hrms/hr/doctype/leave_allocation/leave_allocation.js index 04e9f43465..b488ed6d29 100755 --- a/hrms/hr/doctype/leave_allocation/leave_allocation.js +++ b/hrms/hr/doctype/leave_allocation/leave_allocation.js @@ -35,20 +35,65 @@ frappe.ui.form.on("Leave Allocation", { ); if (valid_expiry) { // expire current allocation - frm.add_custom_button(__("Expire Allocation"), function () { - frm.trigger("expire_allocation"); - }); + frm.add_custom_button( + __("Expire Allocation"), + function () { + frappe.confirm("Are you sure you want to expire this allocation?", () => { + frm.trigger("expire_allocation"); + }); + }, + __("Actions"), + ); } } if (!frm.doc.__islocal && frm.doc.leave_policy_assignment) { frappe.db.get_value("Leave Type", frm.doc.leave_type, "is_earned_leave", (r) => { - if (cint(r?.is_earned_leave)) - frm.set_df_property("new_leaves_allocated", "read_only", 1); + if (!r?.is_earned_leave) return; + frm.set_df_property("new_leaves_allocated", "read_only", 1); + frm.trigger("add_allocate_leaves_button"); }); } }, + add_allocate_leaves_button: async function (frm) { + const { message: monthly_earned_leave } = await frappe.call({ + method: "get_monthly_earned_leave", + doc: frm.doc, + }); + + frm.add_custom_button( + __("Allocate Leaves"), + function () { + const dialog = new frappe.ui.Dialog({ + title: "Manual Leave Allocation", + fields: [ + { + label: "New Leaves to be Allocated", + fieldname: "new_leaves", + fieldtype: "Float", + }, + ], + primary_action_label: "Allocate", + primary_action({ new_leaves }) { + frappe.call({ + method: "allocate_leaves_manually", + doc: frm.doc, + args: { new_leaves }, + callback: function () { + frm.reload_doc(); + }, + }); + dialog.hide(); + }, + }); + dialog.fields_dict.new_leaves.set_value(monthly_earned_leave); + dialog.show(); + }, + __("Actions"), + ); + }, + expire_allocation: function (frm) { frappe.call({ method: "hrms.hr.doctype.leave_ledger_entry.leave_ledger_entry.expire_allocation", @@ -110,6 +155,7 @@ frappe.ui.form.on("Leave Allocation", { ); } }, + calculate_total_leaves_allocated: function (frm) { if (cint(frm.doc.carry_forward) == 1 && frm.doc.leave_type && frm.doc.employee) { return frappe.call({ diff --git a/hrms/hr/doctype/leave_allocation/leave_allocation.py b/hrms/hr/doctype/leave_allocation/leave_allocation.py index 2631f691db..61b90939ac 100755 --- a/hrms/hr/doctype/leave_allocation/leave_allocation.py +++ b/hrms/hr/doctype/leave_allocation/leave_allocation.py @@ -12,7 +12,8 @@ create_leave_ledger_entry, expire_allocation, ) -from hrms.hr.utils import get_leave_period, set_employee_name +from hrms.hr.utils import create_additional_leave_ledger_entry, get_leave_period, set_employee_name +from hrms.hr.utils import get_monthly_earned_leave as _get_monthly_earned_leave class OverlapError(frappe.ValidationError): @@ -312,6 +313,72 @@ def create_leave_ledger_entry(self, submit=True): ) create_leave_ledger_entry(self, args, submit) + @frappe.whitelist() + def allocate_leaves_manually(self, new_leaves): + new_allocation = flt(self.total_leaves_allocated) + flt(new_leaves) + new_allocation_without_cf = flt( + flt(self.get_existing_leave_count()) + flt(new_leaves), + self.precision("total_leaves_allocated"), + ) + + max_leaves_allowed = frappe.db.get_value("Leave Type", self.leave_type, "max_leaves_allowed") + if new_allocation > max_leaves_allowed and max_leaves_allowed > 0: + new_allocation = max_leaves_allowed + + annual_allocation = frappe.db.get_value( + "Leave Policy Detail", + {"parent": self.leave_policy, "leave_type": self.leave_type}, + "annual_allocation", + ) + annual_allocation = flt(annual_allocation, self.precision("total_leaves_allocated")) + + if ( + new_allocation != self.total_leaves_allocated + # annual allocation as per policy should not be exceeded + and new_allocation_without_cf <= annual_allocation + ): + self.db_set("total_leaves_allocated", new_allocation, update_modified=False) + + date = frappe.flags.current_date or getdate() + create_additional_leave_ledger_entry(self, new_leaves, date) + + text = _("{0} leaves were manually allocated by {1} on {2}").format( + frappe.bold(new_leaves), frappe.session.user, frappe.bold(formatdate(date)) + ) + self.add_comment(comment_type="Info", text=text) + + else: + msg = _("Total leaves allocated cannot exceed annual allocation of {0}.").format( + frappe.bold(_(annual_allocation)) + ) + msg += "

" + msg += _("Reference: {0}").format(get_link_to_form("Leave Policy", self.leave_policy)) + frappe.throw(msg, title=_("Annual Allocation Exceeded")) + + @frappe.whitelist() + def get_monthly_earned_leave(self): + doj = frappe.db.get_value("Employee", self.employee, "date_of_joining") + + annual_allocation = frappe.db.get_value( + "Leave Policy Detail", + { + "parent": self.leave_policy, + "leave_type": self.leave_type, + }, + "annual_allocation", + ) + + frequency, rounding = frappe.db.get_value( + "Leave Type", + self.leave_type, + [ + "earned_leave_frequency", + "rounding", + ], + ) + + return _get_monthly_earned_leave(doj, annual_allocation, frequency, rounding) + def get_previous_allocation(from_date, leave_type, employee): """Returns document properties of previous allocation""" diff --git a/hrms/hr/doctype/leave_allocation/test_earned_leaves.py b/hrms/hr/doctype/leave_allocation/test_earned_leaves.py index 0dfdc01818..9f17827f81 100644 --- a/hrms/hr/doctype/leave_allocation/test_earned_leaves.py +++ b/hrms/hr/doctype/leave_allocation/test_earned_leaves.py @@ -3,8 +3,6 @@ from frappe.utils import ( add_days, add_months, - date_diff, - flt, get_first_day, get_last_day, get_year_ending, @@ -477,6 +475,32 @@ def test_get_earned_leave_details_for_dashboard(self): } self.assertEqual(leave_allocation, expected) + def test_allocate_leaves_manually(self): + frappe.flags.current_date = get_year_start(getdate()) + lpas = make_policy_assignment( + self.employee, + allocate_on_day="First Day", + start_date=frappe.flags.current_date, + ) + + leave_allocation = frappe.get_last_doc( + "Leave Allocation", filters={"leave_policy_assignment": lpas[0]} + ) + leave_allocation.allocate_leaves_manually(1) + leave_allocation.allocate_leaves_manually(1) + leave_allocation.allocate_leaves_manually(1) + leave_allocation.allocate_leaves_manually(1) + leave_allocation.allocate_leaves_manually(1) + self.assertEqual( + get_leave_balance_on(self.employee.name, self.leave_type, frappe.flags.current_date), 6 + ) + + leave_allocation.allocate_leaves_manually(6) + self.assertEqual( + get_leave_balance_on(self.employee.name, self.leave_type, frappe.flags.current_date), 12 + ) + self.assertRaises(frappe.ValidationError, leave_allocation.allocate_leaves_manually, 1) + def tearDown(self): frappe.db.set_value("Employee", self.employee.name, "date_of_joining", self.original_doj) frappe.db.set_value("Leave Type", self.leave_type, "max_leaves_allowed", 0) diff --git a/hrms/hr/utils.py b/hrms/hr/utils.py index 7bf8f95c61..9458755726 100644 --- a/hrms/hr/utils.py +++ b/hrms/hr/utils.py @@ -416,6 +416,7 @@ def update_previous_leave_allocation(allocation, annual_allocation, e_leave_type allocation.add_comment(comment_type="Info", text=text) +@frappe.whitelist() def get_monthly_earned_leave( date_of_joining, annual_leaves, @@ -762,21 +763,26 @@ def get_ec_matching_query( filters.append(ec.docstatus == 1) filters.append(ec.is_paid == 1) filters.append(ec.clearance_date.isnull()) - filters.append(ec.mode_of_payment.isin(mode_of_payments)) - if exact_match: - filters.append(ec.total_sanctioned_amount == common_filters.amount) + if mode_of_payments: + filters.append(ec.mode_of_payment.isin(mode_of_payments)) + + if common_filters: + ref_rank = frappe.qb.terms.Case().when(ec.employee == common_filters.party, 1).else_(0) + 1 + + if exact_match: + filters.append(ec.total_sanctioned_amount == common_filters.amount) + else: + filters.append(ec.total_sanctioned_amount.gt(common_filters.amount)) else: - filters.append(ec.total_sanctioned_amount.gt(common_filters.amount)) + ref_rank = ConstantColumn(1) if from_date and to_date: filters.append(ec.posting_date[from_date:to_date]) - ref_rank = frappe.qb.terms.Case().when(ec.employee == common_filters.party, 1).else_(0) - ec_query = ( qb.from_(ec) .select( - (ref_rank + 1).as_("rank"), + ref_rank.as_("rank"), ec.name, ec.total_sanctioned_amount.as_("paid_amount"), ConstantColumn("").as_("reference_no"), diff --git a/hrms/overrides/employee_payment_entry.py b/hrms/overrides/employee_payment_entry.py index d81df71563..2d7b3644c6 100644 --- a/hrms/overrides/employee_payment_entry.py +++ b/hrms/overrides/employee_payment_entry.py @@ -65,7 +65,10 @@ def set_missing_ref_details( continue if field == "exchange_rate" or not d.get(field) or force: - d.db_set(field, value) + if self.get("_action") in ("submit", "cancel"): + d.db_set(field, value) + else: + d.set(field, value) @frappe.whitelist() diff --git a/hrms/www/hrms.py b/hrms/www/hrms.py index 768400facc..50bb5740d1 100644 --- a/hrms/www/hrms.py +++ b/hrms/www/hrms.py @@ -20,4 +20,6 @@ def get_context_for_dev(): def get_boot(): - return frappe._dict({"push_relay_server_url": frappe.conf.get("push_relay_server_url")}) + return frappe._dict( + {"site_name": frappe.local.site, "push_relay_server_url": frappe.conf.get("push_relay_server_url")} + ) diff --git a/roster/src/assets/Inter/Inter-Black.woff b/roster/src/assets/Inter/Inter-Black.woff deleted file mode 100644 index c7737ed3d8..0000000000 Binary files a/roster/src/assets/Inter/Inter-Black.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Black.woff2 b/roster/src/assets/Inter/Inter-Black.woff2 deleted file mode 100644 index b16b995bee..0000000000 Binary files a/roster/src/assets/Inter/Inter-Black.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-BlackItalic.woff b/roster/src/assets/Inter/Inter-BlackItalic.woff deleted file mode 100644 index b5f1447643..0000000000 Binary files a/roster/src/assets/Inter/Inter-BlackItalic.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-BlackItalic.woff2 b/roster/src/assets/Inter/Inter-BlackItalic.woff2 deleted file mode 100644 index a3f1b70cdf..0000000000 Binary files a/roster/src/assets/Inter/Inter-BlackItalic.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Bold.woff b/roster/src/assets/Inter/Inter-Bold.woff deleted file mode 100644 index e38455587f..0000000000 Binary files a/roster/src/assets/Inter/Inter-Bold.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Bold.woff2 b/roster/src/assets/Inter/Inter-Bold.woff2 deleted file mode 100644 index 835dd4977a..0000000000 Binary files a/roster/src/assets/Inter/Inter-Bold.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-BoldItalic.woff b/roster/src/assets/Inter/Inter-BoldItalic.woff deleted file mode 100644 index ffac3f59b5..0000000000 Binary files a/roster/src/assets/Inter/Inter-BoldItalic.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-BoldItalic.woff2 b/roster/src/assets/Inter/Inter-BoldItalic.woff2 deleted file mode 100644 index 1a41a14ff1..0000000000 Binary files a/roster/src/assets/Inter/Inter-BoldItalic.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ExtraBold.woff b/roster/src/assets/Inter/Inter-ExtraBold.woff deleted file mode 100644 index 885ac94fbf..0000000000 Binary files a/roster/src/assets/Inter/Inter-ExtraBold.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ExtraBold.woff2 b/roster/src/assets/Inter/Inter-ExtraBold.woff2 deleted file mode 100644 index ae956b1501..0000000000 Binary files a/roster/src/assets/Inter/Inter-ExtraBold.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ExtraBoldItalic.woff b/roster/src/assets/Inter/Inter-ExtraBoldItalic.woff deleted file mode 100644 index d6cf862332..0000000000 Binary files a/roster/src/assets/Inter/Inter-ExtraBoldItalic.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ExtraBoldItalic.woff2 b/roster/src/assets/Inter/Inter-ExtraBoldItalic.woff2 deleted file mode 100644 index 86578995d2..0000000000 Binary files a/roster/src/assets/Inter/Inter-ExtraBoldItalic.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ExtraLight.woff b/roster/src/assets/Inter/Inter-ExtraLight.woff deleted file mode 100644 index ff76919327..0000000000 Binary files a/roster/src/assets/Inter/Inter-ExtraLight.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ExtraLight.woff2 b/roster/src/assets/Inter/Inter-ExtraLight.woff2 deleted file mode 100644 index 694b2df9fa..0000000000 Binary files a/roster/src/assets/Inter/Inter-ExtraLight.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ExtraLightItalic.woff b/roster/src/assets/Inter/Inter-ExtraLightItalic.woff deleted file mode 100644 index c6ed13a4ff..0000000000 Binary files a/roster/src/assets/Inter/Inter-ExtraLightItalic.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ExtraLightItalic.woff2 b/roster/src/assets/Inter/Inter-ExtraLightItalic.woff2 deleted file mode 100644 index 9a7bd11090..0000000000 Binary files a/roster/src/assets/Inter/Inter-ExtraLightItalic.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Italic.woff b/roster/src/assets/Inter/Inter-Italic.woff deleted file mode 100644 index 4fdb59dc2d..0000000000 Binary files a/roster/src/assets/Inter/Inter-Italic.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Italic.woff2 b/roster/src/assets/Inter/Inter-Italic.woff2 deleted file mode 100644 index deca637d81..0000000000 Binary files a/roster/src/assets/Inter/Inter-Italic.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Light.woff b/roster/src/assets/Inter/Inter-Light.woff deleted file mode 100644 index 42850acc03..0000000000 Binary files a/roster/src/assets/Inter/Inter-Light.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Light.woff2 b/roster/src/assets/Inter/Inter-Light.woff2 deleted file mode 100644 index 65a7dadddb..0000000000 Binary files a/roster/src/assets/Inter/Inter-Light.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-LightItalic.woff b/roster/src/assets/Inter/Inter-LightItalic.woff deleted file mode 100644 index c4ed9a94fa..0000000000 Binary files a/roster/src/assets/Inter/Inter-LightItalic.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-LightItalic.woff2 b/roster/src/assets/Inter/Inter-LightItalic.woff2 deleted file mode 100644 index 555fc55955..0000000000 Binary files a/roster/src/assets/Inter/Inter-LightItalic.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Medium.woff b/roster/src/assets/Inter/Inter-Medium.woff deleted file mode 100644 index 495faef7ff..0000000000 Binary files a/roster/src/assets/Inter/Inter-Medium.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Medium.woff2 b/roster/src/assets/Inter/Inter-Medium.woff2 deleted file mode 100644 index 871ce4ce5d..0000000000 Binary files a/roster/src/assets/Inter/Inter-Medium.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-MediumItalic.woff b/roster/src/assets/Inter/Inter-MediumItalic.woff deleted file mode 100644 index 389c7a2bfe..0000000000 Binary files a/roster/src/assets/Inter/Inter-MediumItalic.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-MediumItalic.woff2 b/roster/src/assets/Inter/Inter-MediumItalic.woff2 deleted file mode 100644 index aa8057992b..0000000000 Binary files a/roster/src/assets/Inter/Inter-MediumItalic.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Regular.woff b/roster/src/assets/Inter/Inter-Regular.woff deleted file mode 100644 index fa7715d120..0000000000 Binary files a/roster/src/assets/Inter/Inter-Regular.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Regular.woff2 b/roster/src/assets/Inter/Inter-Regular.woff2 deleted file mode 100644 index b52dd0a0b7..0000000000 Binary files a/roster/src/assets/Inter/Inter-Regular.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-SemiBold.woff b/roster/src/assets/Inter/Inter-SemiBold.woff deleted file mode 100644 index 18d7749f56..0000000000 Binary files a/roster/src/assets/Inter/Inter-SemiBold.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-SemiBold.woff2 b/roster/src/assets/Inter/Inter-SemiBold.woff2 deleted file mode 100644 index ece5204a19..0000000000 Binary files a/roster/src/assets/Inter/Inter-SemiBold.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-SemiBoldItalic.woff b/roster/src/assets/Inter/Inter-SemiBoldItalic.woff deleted file mode 100644 index 8ee64396a0..0000000000 Binary files a/roster/src/assets/Inter/Inter-SemiBoldItalic.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-SemiBoldItalic.woff2 b/roster/src/assets/Inter/Inter-SemiBoldItalic.woff2 deleted file mode 100644 index b32c0ba3bd..0000000000 Binary files a/roster/src/assets/Inter/Inter-SemiBoldItalic.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Thin.woff b/roster/src/assets/Inter/Inter-Thin.woff deleted file mode 100644 index 1a22286f6e..0000000000 Binary files a/roster/src/assets/Inter/Inter-Thin.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-Thin.woff2 b/roster/src/assets/Inter/Inter-Thin.woff2 deleted file mode 100644 index c56bc7ca6d..0000000000 Binary files a/roster/src/assets/Inter/Inter-Thin.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ThinItalic.woff b/roster/src/assets/Inter/Inter-ThinItalic.woff deleted file mode 100644 index d8ec8373ac..0000000000 Binary files a/roster/src/assets/Inter/Inter-ThinItalic.woff and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-ThinItalic.woff2 b/roster/src/assets/Inter/Inter-ThinItalic.woff2 deleted file mode 100644 index eca5608c0f..0000000000 Binary files a/roster/src/assets/Inter/Inter-ThinItalic.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-italic.var.woff2 b/roster/src/assets/Inter/Inter-italic.var.woff2 deleted file mode 100644 index 1f5d92611a..0000000000 Binary files a/roster/src/assets/Inter/Inter-italic.var.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter-roman.var.woff2 b/roster/src/assets/Inter/Inter-roman.var.woff2 deleted file mode 100644 index 05621d8d16..0000000000 Binary files a/roster/src/assets/Inter/Inter-roman.var.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/Inter.var.woff2 b/roster/src/assets/Inter/Inter.var.woff2 deleted file mode 100644 index 46bb515393..0000000000 Binary files a/roster/src/assets/Inter/Inter.var.woff2 and /dev/null differ diff --git a/roster/src/assets/Inter/inter.css b/roster/src/assets/Inter/inter.css deleted file mode 100644 index db9cf68747..0000000000 --- a/roster/src/assets/Inter/inter.css +++ /dev/null @@ -1,170 +0,0 @@ -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 100; - font-display: swap; - src: - url("Inter-Thin.woff2?v=3.12") format("woff2"), - url("Inter-Thin.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 100; - font-display: swap; - src: - url("Inter-ThinItalic.woff2?v=3.12") format("woff2"), - url("Inter-ThinItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 200; - font-display: swap; - src: - url("Inter-ExtraLight.woff2?v=3.12") format("woff2"), - url("Inter-ExtraLight.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 200; - font-display: swap; - src: - url("Inter-ExtraLightItalic.woff2?v=3.12") format("woff2"), - url("Inter-ExtraLightItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 300; - font-display: swap; - src: - url("Inter-Light.woff2?v=3.12") format("woff2"), - url("Inter-Light.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 300; - font-display: swap; - src: - url("Inter-LightItalic.woff2?v=3.12") format("woff2"), - url("Inter-LightItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 400; - font-display: swap; - src: - url("Inter-Regular.woff2?v=3.12") format("woff2"), - url("Inter-Regular.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 400; - font-display: swap; - src: - url("Inter-Italic.woff2?v=3.12") format("woff2"), - url("Inter-Italic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 500; - font-display: swap; - src: - url("Inter-Medium.woff2?v=3.12") format("woff2"), - url("Inter-Medium.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 500; - font-display: swap; - src: - url("Inter-MediumItalic.woff2?v=3.12") format("woff2"), - url("Inter-MediumItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 600; - font-display: swap; - src: - url("Inter-SemiBold.woff2?v=3.12") format("woff2"), - url("Inter-SemiBold.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 600; - font-display: swap; - src: - url("Inter-SemiBoldItalic.woff2?v=3.12") format("woff2"), - url("Inter-SemiBoldItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 700; - font-display: swap; - src: - url("Inter-Bold.woff2?v=3.12") format("woff2"), - url("Inter-Bold.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 700; - font-display: swap; - src: - url("Inter-BoldItalic.woff2?v=3.12") format("woff2"), - url("Inter-BoldItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 800; - font-display: swap; - src: - url("Inter-ExtraBold.woff2?v=3.12") format("woff2"), - url("Inter-ExtraBold.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 800; - font-display: swap; - src: - url("Inter-ExtraBoldItalic.woff2?v=3.12") format("woff2"), - url("Inter-ExtraBoldItalic.woff?v=3.12") format("woff"); -} - -@font-face { - font-family: "Inter"; - font-style: normal; - font-weight: 900; - font-display: swap; - src: - url("Inter-Black.woff2?v=3.12") format("woff2"), - url("Inter-Black.woff?v=3.12") format("woff"); -} -@font-face { - font-family: "Inter"; - font-style: italic; - font-weight: 900; - font-display: swap; - src: - url("Inter-BlackItalic.woff2?v=3.12") format("woff2"), - url("Inter-BlackItalic.woff?v=3.12") format("woff"); -} diff --git a/roster/src/index.css b/roster/src/index.css index fab5bccb0c..49a32792e1 100644 --- a/roster/src/index.css +++ b/roster/src/index.css @@ -1,2 +1 @@ -@import "./assets/Inter/inter.css"; @import "frappe-ui/src/style.css"; diff --git a/roster/vite.config.js b/roster/vite.config.js index 72f2dc0ed5..7c068e5180 100644 --- a/roster/vite.config.js +++ b/roster/vite.config.js @@ -16,7 +16,7 @@ export default defineConfig({ }, }, build: { - outDir: `../${path.basename(path.resolve(".."))}/public/roster`, + outDir: `../hrms/public/roster`, emptyOutDir: true, target: "es2015", commonjsOptions: {