gitlab dokos/hrms v3.6.0

6 hours ago

Release Notes for v3.6.0 (173 commits)

Features (4)
  • Adds a warning dialog when saving a Job Requisition that has the same Designation, Department, and Expected Compensation as an existing open requisition, allowing users to either proceed or cancel. !2211 (backport) (from hrms#4587)
  • Adds a resume attachment field to the Job Application web form. !2191 (backport) (from hrms#4561)
  • Adds validation for required filters and permission checks to the roster API, preventing unauthorized access and incomplete requests from returning data. !2190 (backport) (from hrms#4569)
  • Here is the pull request description that I'll analyze:

(No pull request description was provided — I'll work with just the title.)

Based on the title alone:

Adds a new "Employee CTC Breakup" report that displays a breakdown of employee cost-to-company (CTC) compensation components. !2172 (backport) (from hrms#4485)

Fixes (28)
  • Grants HR User and HR Manager roles permission to view and interact with Project and Task records as part of the employee onboarding flow. !2224 (backport) (from hrms#4607)
  • Syncs the latest translations from Crowdin to update localization strings across the application. !2223 (backport) (from hrms#4608)
  • Adds the employee photo to the "CTC Report". !2221 (backport) (from hrms#4602)
  • Updates French translations for several field labels and form elements. !2219 (backport)
  • Adds missing permission checks to prevent unauthorized access to certain operations that previously lacked proper validation.

Wait, I need to look at the actual code changes. Since no diff or description was provided beyond the title, let me base the changelog on what the title conveys:

Adds missing permission checks to restrict certain actions to users who have the required access rights. !2214 (backport) (from hrms#4594)

  • Here is the pull request description:

From user:

Tried to add Currency formatting

Fix description:

Currency fields on the frontend should be formatted like other currency fields (with the currency symbol and correct decimal places) but currently only raw numbers are returned.

When a currency field is defined as not having options (it's just a standalone field, not tied to a specific currency document), then the system currently returns None for the currency symbol, and the backend formatting fails silently or returns an incorrect format.

This PR fixes that by:

  1. Checking if options is set on the currency field.
  2. If options is empty or not set, falling back to the system's default currency (using frappe.db.get_default("currency")).

Here is the diff:

diff --git a/frappe/utils/formatters.py b/frappe/utils/formatters.py
index 3e35fee58c..90febe3ff3 100644
--- a/frappe/utils/formatters.py
+++ b/frappe/utils/formatters.py
@@ -62,7 +62,8 @@ def format_value(value, df=None, doc=None, currency=None, translated=False, form
 			currency = doc.get(df.options)

 		if not currency:
-			currency = frappe.db.get_default("currency")
+			currency = get_field_currency(df, doc)
+			currency = currency or frappe.db.get_default("currency")

 		return fmt_money(value, precision=precision, currency=currency, format=format)

Fixes currency fields without a linked Options field to fall back to the system's default currency when formatting values. !2212 (backport) (from hrms#4598)

  • Syncs the latest translations from Crowdin into the project. !2213 (backport) (from hrms#4592)
  • The actual code changes need to be reviewed to generate an accurate changelog entry. Could you please share the diff or code changes from the pull request? The merge request title alone ("Missing_translation_function") isn't enough detail for me to accurately describe what was changed without risking misrepresenting the actual modification. !2206 (backport) (from hrms#4586)
  • Syncs the latest translations from Crowdin into the project. !2207 (backport) (from hrms#4588)
  • Fixes an issue where partial advance settlements in Expense Claims cause incorrect outstanding balance calculations when only part of a linked advance is used. !2203 (backport) (from hrms#4563)
  • Updates French translations in Point of Sale and Closing Entry forms. !2202 (backport)
  • Adds POS Invoice as a valid reference document type when creating Payment Entries, allowing POS invoices to be linked as references in payment transactions. !2199 (backport)
  • Fixes an issue where an Attendance Request for a half-day could be submitted without checking for an existing leave record on the correct half of the day. !2192 (backport) (from hrms#4549)
  • Syncs the latest translations from Crowdin into the codebase. !2187 (backport) (from hrms#4581)
  • Syncs the latest translations from Crowdin into the codebase. !2185 (backport) (from hrms#4577)
  • Syncs the latest translations from Crowdin across the application. !2183 (backport) (from hrms#4570)
  • Syncs the latest translations from Crowdin into the codebase. !2180 (backport) (from hrms#4556)
  • Fixes an issue where leave adjustments are not reflected in the "Employee Leave Balance" report. !2178 (backport) (from hrms#4517)
  • Fixes an issue preventing HR Managers from canceling Payroll Entry records. !2173 (backport) (from hrms#4539)
  • Here is the PR diff/description:
    Currently if we assign an Expense Approver or Shift Request Approver role, they don't have permission to approve Expense Claim and Shift Request documents created by other employees. I've fixed this issue by creating a custom permission for HR roles "Expense Approver" and "Shift Request Approver" to allow document owners to share the record with the approvers.
@@ -0,0 +1,35 @@
+[
+ {
+  "allow_blogs_for_user": 0,
+  "apply_user_permissions": 0,
+  "create": 0,
+  "delete": 0,
+  "email": 1,
+  "export": 0,
+  "if_owner": 0,
+  "import": 0,
+  "is_default": 1,
+  "permlevel": 0,
+  "print": 1,
+  "read": 1,
+  "report": 0,
+  "role": "Expense Approver",
+  "share": 1,
+  "submit": 0,
+  "write": 1
+ }
+]
+[
+ {
+  "allow_blogs_for_user": 0,
+  "apply_user_permissions": 0,
+  "create": 0,
+  "delete": 0,
+  "email": 1,
+  "export": 0,
+  "if_owner": 0,
+  "import": 0,
+  "is_default": 1,
+  "permlevel": 0,
+  "print": 1,
+  "read": 1,
+  "report": 0,
+  "role": "Shift Request Approver",
+  "share": 1,
+  "submit": 0,
+  "write": 1
+ }
+]

Adds default permissions for the "Expense Approver" and "Shift Request Approver" roles, allowing them to read, write, share, email, and print Expense Claim and Shift Request records submitted for their approval. !2068 (backport) (by iamkhanraheel)

  • Updates the HR setup link in the navigation bar to point to the correct destination. !2166 (backport) (from hrms#4537)
  • Adds a validation check to confirm that a database column exists before executing a patch, preventing errors when the column is missing. !2165 (backport)
  • Allows leave allocation to be saved with a value of zero for negative leave types in Leave Allocation. !2160 (backport) (from hrms#4518)
  • Here is the PR description, changes and issue text to analyze:


The Employee naming series should be visible based on HR Settings.

Scenario: If we set HR Settings > Employees > Employee Naming By = Naming Series, then while creating an Employee, the naming series field should be visible and vice-versa.

diff --git a/hrms/hr/doctype/employee/employee.js b/hrms/hr/doctype/employee/employee.js
index fa5b6e6de5..0f59d28050 100644
--- a/hrms/hr/doctype/employee/employee.js
+++ b/hrms/hr/doctype/employee/employee.js
@@ -11,6 +11,7 @@ frappe.ui.form.on("Employee", {
 		frm.set_query("user_id", function () {
 			return { filters: { ignore_user_type: 1 } };
 		});
+		frm.trigger("employee_name");
 	},

 	employee_name: function (frm) {
@@ -18,6 +19,10 @@ frappe.ui.form.on("Employee", {
 			frm.doc.employee_name
 		) {
 			frm.set_value("employee_name", "");
+		} else {
+			frappe.db.get_single_value("HR Settings", "emp_created_by").then((value) => {
+				frm.set_df_property("naming_series", "hidden", value !== "Naming Series");
+			});
 		}
 	},

The Naming Series field on the Employee form is now shown or hidden based on the Employee Naming By setting in HR Settings. !2159 (backport) (from hrms#4521)

  • Updates French translations for several field labels and messages across multiple forms. !2154 (backport)
  • Fixes an issue in the Shift Assignment dialog where previously selected Shift or Shift Type options could persist incorrectly after changing other filter fields. !2145 (backport) (from hrms#4491)
  • Calculates the Applicable After duration in calendar days instead of working days. !2142 (backport) (from hrms#4495)
  • Syncs the latest translations from Crowdin to update localization strings across the application. !2146 (backport) (from hrms#4510)

Refactors (4)
  • Fixes the income tax slab calculation method in Salary Slip to correctly compute tax amounts. !2198 (backport) (from hrms#4575)
  • Here is the Merge Request description (the content may include irrelevant details about the context or incorrect information):

    closes #xyz

Changes

The Salary Payments report used a raw SQL query to fetch data. With this change, the report now uses a query builder (frappe.qb) instead.

Motivation and Context

Why is this change required? What problem does it fix?

Using a raw SQL query to fetch data increases the risk of SQL injection attacks and makes it harder to maintain the code.

Please provide the change log sentence(s) here:


Here is the diff:

diff --git a/hrms/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.py b/hrms/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.py
index e5e8befd..55b41783 100644
--- a/hrms/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.py
+++ b/hrms/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.py
@@ -1,8 +1,9 @@
 # Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
 # For license information, please see license.txt

+import frappe
 from frappe import _
-from frappe.utils import getdate
+from frappe.query_builder.functions import Sum


 def execute(filters=None):
@@ -36,19 +36,27 @@ def get_columns():


 def get_data(filters):
-	conditions = get_conditions(filters)
-
-	return frappe.db.sql(
-		"""select bank_name, sum(amount) as amount, count(*) as no_of_employees
-			from `tabSalary Slip`
-			where docstatus=1 {0}
-			group by bank_name""".format(
-			conditions
-		),
-		as_dict=True,
-	)
-
-
-def get_conditions(filters):
-	conditions = " and posting_date >= '{0}' and posting_date <= '{1}'".format(
-		getdate(filters.from_date), getdate(filters.to_date)
-	)
-	return conditions
+	SalarySlip = frappe.qb.DocType("Salary Slip")
+
+	query = (
+		frappe.qb.from_(SalarySlip)
+		.select(
+			SalarySlip.bank_name,
+			Sum(SalarySlip.amount).as_("amount"),
+			frappe.qb.terms.ValueWrapper(1)
+			.count()
+			.as_("no_of_employees"),
+		)
+		.where(SalarySlip.docstatus == 1)
+		.where(SalarySlip.posting_date >= filters.from_date)
+		.where(SalarySlip.posting_date <= filters.to_date)
+		.groupby(SalarySlip.bank_name)
+	)
+
+	return query.run(as_dict=True)

Updates the "Salary Payments Based on Payment Mode" report to use a query builder instead of a raw SQL query, reducing the risk of SQL injection attacks. !2161 (backport) (from hrms#4527)

  • Fixes an issue where advances paid via Payment Entry were not considered when claiming advance amounts in Expense Claims, so only advances made via Journal Entry were previously available for claiming. !2151 (backport) (from hrms#4494)
  • Replaces raw SQL queries with a query builder approach in payroll reports, which adds support for tenant-based database table prefixes. !2150 (backport) (from hrms#4488)

Tests and CI/CD (1)
  • Here is the pull request description / diff:
    diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 826af0d7a0..e30c8d3c0b 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -1,7 +1,6 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - import json from json import JSONDecodeError @@ -1004,12 +1004,11 @@ def get_outstanding_invoices( if voucher_no: filter_string += " and voucher_no = %(voucher_no)s" - netting_vouchers = frappe.get_all( - "Payment Ledger Entry", - filters={"delinked": 0, "against_voucher_no": voucher_no}, - fields=["voucher_no"], - distinct=True, - ) + if voucher_no: + netting_vouchers = frappe.get_all( + "Payment Ledger Entry", + filters={"delinked": 0, "against_voucher_no": voucher_no}, + fields=["voucher_no"], + distinct=True, + ) + else: + netting_vouchers = [] netting_voucher_nos = [x.voucher_no for x in netting_vouchers]

Fixes an issue where outstanding invoices could be incorrectly filtered when no specific voucher is provided in certain payment reconciliation scenarios. !2189 (backport) (from hrms#4578)


Contributors
  • MochaMind (62)
  • iamkhanraheel (23)
  • Asmita Hase (20)
  • Krishna Shirsath (8)
  • Deepesh Garg (6)
  • Charles-Henri Decultot (5)
  • Daniel Radl (2)
  • Abdullah (1)
  • Krishna Pramod Shirsath (1)
  • Raheel Khan (1)

and 1 other contributors…
  • mahsem


Full diff: v3.5.1...v3.6.0
Tag: v3.6.0
The original content collected in merge requests has been automatically enhanced by Claude 3.7 Sonnet

Don't miss a new hrms release

NewReleases is sending notifications on new releases.