Skip to content

Commit 8a85c90

Browse files
authored
Merge pull request #1449 from frappe/version-15-hotfix
chore: release v15
2 parents 24ec35d + 172eca5 commit 8a85c90

File tree

7 files changed

+52
-29
lines changed

7 files changed

+52
-29
lines changed

.github/helper/install.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile
4242

4343
bench get-app payments --branch ${BRANCH_TO_CLONE%"-hotfix"}
4444
bench get-app https://github.com/frappe/erpnext --branch "$BRANCH_TO_CLONE" --resolve-deps
45+
bench get-app https://github.com/frappe/lending --branch ${BRANCH_TO_CLONE%"-hotfix"}
4546
bench get-app hrms "${GITHUB_WORKSPACE}"
4647
bench setup requirements --dev
4748

4849
bench start &>> ~/frappe-bench/bench_start.log &
4950
CI=Yes bench build --app frappe &
5051
bench --site test_site reinstall --yes
5152

52-
bench --verbose --site test_site install-app hrms
53+
bench --verbose --site test_site install-app lending
54+
bench --verbose --site test_site install-app hrms

hrms/hr/doctype/leave_application/leave_application.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,13 @@ def _get_first_from_date(reference_date):
497497
prev_date = add_days(reference_date, -1)
498498
application = frappe.db.get_value(
499499
"Leave Application",
500-
{"employee": self.employee, "leave_type": self.leave_type, "to_date": prev_date},
500+
{
501+
"employee": self.employee,
502+
"leave_type": self.leave_type,
503+
"to_date": prev_date,
504+
"docstatus": ["!=", 2],
505+
"status": ["in", ["Open", "Approved"]],
506+
},
501507
["name", "from_date"],
502508
as_dict=True,
503509
)
@@ -511,7 +517,13 @@ def _get_last_to_date(reference_date):
511517
next_date = add_days(reference_date, 1)
512518
application = frappe.db.get_value(
513519
"Leave Application",
514-
{"employee": self.employee, "leave_type": self.leave_type, "from_date": next_date},
520+
{
521+
"employee": self.employee,
522+
"leave_type": self.leave_type,
523+
"from_date": next_date,
524+
"docstatus": ["!=", 2],
525+
"status": ["in", ["Open", "Approved"]],
526+
},
515527
["name", "to_date"],
516528
as_dict=True,
517529
)
@@ -588,7 +600,7 @@ def notify_employee(self):
588600
frappe.msgprint(_("Please set default template for Leave Status Notification in HR Settings."))
589601
return
590602
email_template = frappe.get_doc("Email Template", template)
591-
message = frappe.render_template(email_template.response, args)
603+
message = frappe.render_template(email_template.response_, args)
592604

593605
self.notify(
594606
{
@@ -613,7 +625,7 @@ def notify_leave_approver(self):
613625
)
614626
return
615627
email_template = frappe.get_doc("Email Template", template)
616-
message = frappe.render_template(email_template.response, args)
628+
message = frappe.render_template(email_template.response_, args)
617629

618630
self.notify(
619631
{

hrms/hr/employee_property_update.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ frappe.ui.form.on(cur_frm.doctype, {
5757
frappe.model.with_doctype("Employee", () => {
5858
const field_label_map = {};
5959
frappe.get_meta("Employee").fields.forEach(d => {
60-
field_label_map[d.fieldname] = __(d.label) + ` (${d.fieldname})`;
60+
field_label_map[d.fieldname] = __(d.label, null, d.parent) + ` (${d.fieldname})`;
6161
if (
6262
!in_list(exclude_field_types, d.fieldtype)
6363
&& !in_list(exclude_fields, d.fieldname)

hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def get_attendance_status_for_detailed_view(
512512
status = get_holiday_status(day, holidays)
513513

514514
abbr = status_map.get(status, "")
515-
row[day] = abbr
515+
row[cstr(day)] = abbr
516516

517517
attendance_values.append(row)
518518

hrms/hr/report/monthly_attendance_sheet/test_monthly_attendance_sheet.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ def test_detailed_view(self):
8989
row_without_shift = report[1][1]
9090

9191
self.assertEqual(day_shift_row["shift"], "Day Shift")
92-
self.assertEqual(day_shift_row[1], "A") # absent on the 1st day of the month
93-
self.assertEqual(day_shift_row[2], "P") # present on the 2nd day
92+
self.assertEqual(day_shift_row["1"], "A") # absent on the 1st day of the month
93+
self.assertEqual(day_shift_row["2"], "P") # present on the 2nd day
9494

9595
self.assertEqual(row_without_shift["shift"], "")
96-
self.assertEqual(row_without_shift[4], "P") # present on the 4th day
96+
self.assertEqual(row_without_shift["4"], "P") # present on the 4th day
9797

9898
# leave should be shown against every shift
99-
self.assertTrue(day_shift_row[3] == row_without_shift[3] == "L")
99+
self.assertTrue(day_shift_row["3"] == row_without_shift["3"] == "L")
100100

101101
@set_holiday_list("Salary Slip Test Holiday List", "_Test Company")
102102
def test_single_shift_with_leaves_in_detailed_view(self):
@@ -125,9 +125,9 @@ def test_single_shift_with_leaves_in_detailed_view(self):
125125
day_shift_row = report[1][0]
126126

127127
self.assertEqual(day_shift_row["shift"], "Day Shift")
128-
self.assertEqual(day_shift_row[1], "A") # absent on the 1st day of the month
129-
self.assertEqual(day_shift_row[2], "P") # present on the 2nd day
130-
self.assertEqual(day_shift_row[3], "L") # leave on the 3rd day
128+
self.assertEqual(day_shift_row["1"], "A") # absent on the 1st day of the month
129+
self.assertEqual(day_shift_row["2"], "P") # present on the 2nd day
130+
self.assertEqual(day_shift_row["3"], "L") # leave on the 3rd day
131131

132132
@set_holiday_list("Salary Slip Test Holiday List", "_Test Company")
133133
def test_single_leave_record(self):
@@ -150,7 +150,7 @@ def test_single_leave_record(self):
150150
row = report[1][0]
151151

152152
self.assertIsNone(row["shift"])
153-
self.assertEqual(row[1], "L")
153+
self.assertEqual(row["1"], "L")
154154

155155
@set_holiday_list("Salary Slip Test Holiday List", "_Test Company")
156156
def test_summarized_view(self):
@@ -233,12 +233,12 @@ def test_attendance_with_group_by_filter(self):
233233
row_without_shift = report[1][2]
234234

235235
self.assertEqual(day_shift_row["shift"], "Day Shift")
236-
self.assertEqual(day_shift_row[1], "A") # absent on the 1st day of the month
237-
self.assertEqual(day_shift_row[2], "P") # present on the 2nd day
236+
self.assertEqual(day_shift_row["1"], "A") # absent on the 1st day of the month
237+
self.assertEqual(day_shift_row["2"], "P") # present on the 2nd day
238238

239239
self.assertEqual(row_without_shift["shift"], "")
240-
self.assertEqual(row_without_shift[3], "L") # on leave on the 3rd day
241-
self.assertEqual(row_without_shift[4], "P") # present on the 4th day
240+
self.assertEqual(row_without_shift["3"], "L") # on leave on the 3rd day
241+
self.assertEqual(row_without_shift["4"], "P") # present on the 4th day
242242

243243
def test_attendance_with_employee_filter(self):
244244
previous_month_first = get_first_day_for_prev_month()

hrms/payroll/doctype/payroll_entry/test_payroll_entry.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ def setup_lending():
770770
from lending.loan_management.doctype.loan.test_loan import (
771771
create_loan_accounts,
772772
create_loan_product,
773+
set_loan_settings_in_company,
773774
)
774775

775776
company = "_Test Company"
@@ -778,6 +779,7 @@ def setup_lending():
778779
if not frappe.db.exists("Branch", branch):
779780
frappe.get_doc({"doctype": "Branch", "branch": branch}).insert()
780781

782+
set_loan_settings_in_company(company)
781783
applicant = make_employee("[email protected]", company="_Test Company", branch=branch)
782784
company_doc = frappe.get_doc("Company", company)
783785

@@ -797,7 +799,6 @@ def setup_lending():
797799
500000,
798800
8.4,
799801
is_term_loan=1,
800-
mode_of_payment="Cash",
801802
disbursement_account="Disbursement Account - _TC",
802803
payment_account="Payment Account - _TC",
803804
loan_account="Loan Account - _TC",

hrms/payroll/doctype/salary_slip/test_salary_slip.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -674,13 +674,15 @@ def test_loan_repayment_salary_slip(self):
674674
create_loan_accounts,
675675
create_loan_product,
676676
make_loan_disbursement_entry,
677+
set_loan_settings_in_company,
677678
)
678679
from lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
679680
process_loan_interest_accrual_for_term_loans,
680681
)
681682

682683
from hrms.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
683684

685+
set_loan_settings_in_company("_Test Company")
684686
applicant = make_employee("[email protected]", company="_Test Company")
685687

686688
create_loan_accounts()
@@ -691,7 +693,6 @@ def test_loan_repayment_salary_slip(self):
691693
500000,
692694
8.4,
693695
is_term_loan=1,
694-
mode_of_payment="Cash",
695696
disbursement_account="Disbursement Account - _TC",
696697
payment_account="Payment Account - _TC",
697698
loan_account="Loan Account - _TC",
@@ -708,6 +709,7 @@ def test_loan_repayment_salary_slip(self):
708709
employee=applicant,
709710
currency="INR",
710711
payroll_period=payroll_period,
712+
company="_Test Company",
711713
)
712714

713715
frappe.db.sql(
@@ -770,9 +772,10 @@ def test_loan_write_off_salary_slip(self):
770772
from lending.loan_management.doctype.loan.test_loan import (
771773
create_loan,
772774
create_loan_accounts,
773-
create_loan_type,
775+
create_loan_product,
774776
create_repayment_entry,
775777
make_loan_disbursement_entry,
778+
set_loan_settings_in_company,
776779
)
777780
from lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
778781
process_loan_interest_accrual_for_term_loans,
@@ -781,15 +784,18 @@ def test_loan_write_off_salary_slip(self):
781784
from hrms.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
782785

783786
applicant = make_employee("[email protected]", company="_Test Company")
787+
frappe.db.delete("Loan", {"applicant": applicant})
788+
frappe.db.delete("Loan Application", {"applicant": applicant})
789+
set_loan_settings_in_company("_Test Company")
784790

785791
create_loan_accounts()
786792

787-
create_loan_type(
793+
create_loan_product(
794+
"Personal Loan",
788795
"Personal Loan",
789796
12000,
790797
0,
791798
is_term_loan=1,
792-
mode_of_payment="Cash",
793799
disbursement_account="Disbursement Account - _TC",
794800
payment_account="Payment Account - _TC",
795801
loan_account="Loan Account - _TC",
@@ -807,18 +813,17 @@ def test_loan_write_off_salary_slip(self):
807813
company="_Test Company",
808814
currency="INR",
809815
payroll_period=payroll_period,
816+
from_date=payroll_period.start_date,
810817
)
811818

812-
frappe.db.sql(
813-
"delete from tabLoan where applicant = '[email protected]'"
814-
)
815819
loan = create_loan(
816820
applicant,
817821
"Personal Loan",
818822
12000,
819823
"Repay Over Number of Periods",
820824
12,
821825
posting_date=payroll_period.start_date,
826+
repayment_start_date=payroll_period.start_date,
822827
)
823828
loan.repay_from_salary = 1
824829
loan.submit()
@@ -1650,10 +1655,13 @@ def make_employee_salary_slip(emp_id, payroll_frequency, salary_structure=None,
16501655
salary_slip_name = frappe.db.get_value("Salary Slip", {"employee": emp_id})
16511656

16521657
if not salary_slip_name:
1653-
salary_slip = make_salary_slip(salary_structure_doc.name, employee=employee.name)
1658+
date = posting_date or nowdate()
1659+
salary_slip = make_salary_slip(
1660+
salary_structure_doc.name, employee=employee.name, posting_date=date
1661+
)
16541662
salary_slip.employee_name = employee.employee_name
16551663
salary_slip.payroll_frequency = payroll_frequency
1656-
salary_slip.posting_date = posting_date or nowdate()
1664+
salary_slip.posting_date = date
16571665
salary_slip.insert()
16581666
else:
16591667
salary_slip = frappe.get_doc("Salary Slip", salary_slip_name)

0 commit comments

Comments
 (0)