Skip to content

Commit

Permalink
Merge pull request #2052 from frappe/version-15-hotfix
Browse files Browse the repository at this point in the history
chore: release v15
  • Loading branch information
ruchamahabal authored Aug 7, 2024
2 parents ff91e70 + ddf4cdb commit 996f4a5
Show file tree
Hide file tree
Showing 14 changed files with 1,140 additions and 39 deletions.
1 change: 1 addition & 0 deletions hrms/hr/doctype/attendance/attendance.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def get_duplicate_attendance_record(self) -> str | None:
& (Attendance.attendance_date == self.attendance_date)
& (Attendance.name != self.name)
)
.for_update()
)

if self.shift:
Expand Down
6 changes: 4 additions & 2 deletions hrms/hr/doctype/leave_application/leave_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ def notify_employee(self):
frappe.msgprint(_("Please set default template for Leave Status Notification in HR Settings."))
return
email_template = frappe.get_doc("Email Template", template)
subject = frappe.render_template(email_template.subject, args)
message = frappe.render_template(email_template.response_, args)

self.notify(
Expand All @@ -605,7 +606,7 @@ def notify_employee(self):
"message": message,
"message_to": employee_email,
# for email
"subject": email_template.subject,
"subject": subject,
"notify": "employee",
}
)
Expand All @@ -622,6 +623,7 @@ def notify_leave_approver(self):
)
return
email_template = frappe.get_doc("Email Template", template)
subject = frappe.render_template(email_template.subject, args)
message = frappe.render_template(email_template.response_, args)

self.notify(
Expand All @@ -630,7 +632,7 @@ def notify_leave_approver(self):
"message": message,
"message_to": self.leave_approver,
# for email
"subject": email_template.subject,
"subject": subject,
}
)

Expand Down
5 changes: 3 additions & 2 deletions hrms/payroll/doctype/payroll_entry/payroll_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,12 +918,13 @@ def make_bank_entry(self, for_withheld_salaries=False):

salary_slip_total -= salary_detail.amount

bank_entry = None
if salary_slip_total > 0:
remark = "withheld salaries" if for_withheld_salaries else "salaries"
bank_entry = self.set_accounting_entries_for_bank_entry(salary_slip_total, remark)

if for_withheld_salaries:
link_bank_entry_in_salary_withholdings(salary_slips, bank_entry.name)
if for_withheld_salaries:
link_bank_entry_in_salary_withholdings(salary_slips, bank_entry.name)

return bank_entry

Expand Down
2 changes: 0 additions & 2 deletions hrms/payroll/doctype/payroll_period/payroll_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ def get_period_factor(

if relieving_date and getdate(relieving_date) < getdate(period_end):
period_end = relieving_date
if month_diff(period_end, start_date) > 1:
start_date = add_months(start_date, -(month_diff(period_end, start_date) + 1))

total_sub_periods, remaining_sub_periods = 0.0, 0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// For license information, please see license.txt
/* eslint-disable */

frappe.require("assets/hrms/js/salary_slip_deductions_report_filters.js", function () {
frappe.query_reports["Income Tax Deductions"] = hrms.salary_slip_deductions_report_filters;
});
frappe.query_reports["Income Tax Deductions"] = $.extend(
{},
hrms.salary_slip_deductions_report_filters,
);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// For license information, please see license.txt
/* eslint-disable */

frappe.require("assets/hrms/js/salary_slip_deductions_report_filters.js", function () {
frappe.query_reports["Professional Tax Deductions"] =
hrms.salary_slip_deductions_report_filters;
});
frappe.query_reports["Professional Tax Deductions"] = $.extend(
{},
hrms.salary_slip_deductions_report_filters,
);
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ def get_data(filters):
WHERE sal.name = ded.parent
AND ded.parentfield = 'deductions'
AND ded.parenttype = 'Salary Slip'
AND sal.docstatus = 1 %s
AND ded.salary_component IN (%s)
""",
(conditions, ", ".join(["%s"] * len(component_type_dict))),
AND sal.docstatus = 1 {}
AND ded.salary_component IN ({})
""".format(conditions, ", ".join(["%s"] * len(component_type_dict))),
tuple(component_type_dict.keys()),
as_dict=1,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// For license information, please see license.txt
/* eslint-disable */

frappe.require("assets/hrms/js/salary_slip_deductions_report_filters.js", function () {
frappe.query_reports["Provident Fund Deductions"] = hrms.salary_slip_deductions_report_filters;
});
frappe.query_reports["Provident Fund Deductions"] = $.extend(
{},
hrms.salary_slip_deductions_report_filters,
);
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ def get_data(filters):
and ded.parenttype = 'Salary Slip'
and sal.docstatus = 1 {}
and ded.salary_component in ({})
""",
(conditions, ", ".join(["%s"] * len(component_type_dict.keys()))),
""".format(conditions, ", ".join(["%s"] * len(component_type_dict.keys()))),
tuple(component_type_dict.keys()),
as_dict=1,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
// For license information, please see license.txt
/* eslint-disable */

frappe.require("assets/hrms/js/salary_slip_deductions_report_filters.js", function () {
frappe.query_reports["Salary Payments Based On Payment Mode"] =
hrms.salary_slip_deductions_report_filters;
});
frappe.query_reports["Salary Payments Based On Payment Mode"] = $.extend(
{},
hrms.salary_slip_deductions_report_filters,
{
formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
if (data.branch && data.branch.includes("Total") && column.colIndex === 1) {
value = value.bold();
}
return value;
},
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def get_data(filters, mode_of_payments):
if data:
data.append(total_row)
data.append({})
data.append({"branch": "<b>Total Gross Pay</b>", mode_of_payments[0]: gross_pay})
data.append({"branch": "<b>Total Deductions</b>", mode_of_payments[0]: total_deductions})
data.append({"branch": "<b>Total Net Pay</b>", mode_of_payments[0]: total_row.get("total")})
data.append({"branch": "Total Gross Pay", mode_of_payments[0]: gross_pay})
data.append({"branch": "Total Deductions", mode_of_payments[0]: total_deductions})
data.append({"branch": "Total Net Pay", mode_of_payments[0]: total_row.get("total")})

currency = erpnext.get_company_currency(filters.company)
report_summary = get_report_summary(gross_pay, total_deductions, total_row.get("total"), currency)
Expand All @@ -124,7 +124,7 @@ def get_data(filters, mode_of_payments):

def get_total_based_on_mode_of_payment(data, mode_of_payments):
total = 0
total_row = {"branch": "<b>Total</b>"}
total_row = {"branch": "Total"}
for mode in mode_of_payments:
sum_of_payment = sum([detail[mode] for detail in data if mode in detail.keys()])
total_row[mode] = sum_of_payment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// For license information, please see license.txt
/* eslint-disable */

frappe.require("assets/hrms/js/salary_slip_deductions_report_filters.js", function () {
let ecs_checklist_filter = hrms.salary_slip_deductions_report_filters;
ecs_checklist_filter["filters"].push({
fieldname: "type",
label: __("Type"),
fieldtype: "Select",
options: ["", "Bank", "Cash", "Cheque"],
});
frappe.query_reports["Salary Payments via ECS"] = $.extend(
{},
hrms.salary_slip_deductions_report_filters,
);

frappe.query_reports["Salary Payments via ECS"] = ecs_checklist_filter;
frappe.query_reports["Salary Payments via ECS"]["filters"].push({
fieldname: "type",
label: __("Type"),
fieldtype: "Select",
options: ["", "Bank", "Cash", "Cheque"],
});
1 change: 1 addition & 0 deletions hrms/public/js/hrms.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ import "./templates/rating.html";
import "./utils";
import "./utils/payroll_utils";
import "./utils/leave_utils";
import "./salary_slip_deductions_report_filters.js";
Loading

0 comments on commit 996f4a5

Please sign in to comment.