-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1018 from frappe/version-14-hotfix
chore: release v14
- Loading branch information
Showing
8 changed files
with
176 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -631,6 +631,7 @@ def test_loan_repayment_salary_slip(self): | |
"Test Loan Repayment Salary Structure", | ||
"Monthly", | ||
employee=applicant, | ||
company="_Test Company", | ||
currency="INR", | ||
payroll_period=payroll_period, | ||
) | ||
|
@@ -689,6 +690,94 @@ def test_payroll_frequency(self): | |
elif payroll_frequency == "Daily": | ||
self.assertEqual(ss.end_date, nowdate()) | ||
|
||
def test_loan_write_off_salary_slip(self): | ||
from erpnext.loan_management.doctype.loan.loan import make_loan_write_off | ||
from erpnext.loan_management.doctype.loan.test_loan import ( | ||
create_loan, | ||
create_loan_accounts, | ||
create_loan_type, | ||
create_repayment_entry, | ||
make_loan_disbursement_entry, | ||
) | ||
from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import ( | ||
process_loan_interest_accrual_for_term_loans, | ||
) | ||
|
||
from hrms.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure | ||
|
||
applicant = make_employee("[email protected]", company="_Test Company") | ||
|
||
create_loan_accounts() | ||
|
||
create_loan_type( | ||
"Personal Loan", | ||
12000, | ||
0, | ||
is_term_loan=1, | ||
mode_of_payment="Cash", | ||
disbursement_account="Disbursement Account - _TC", | ||
payment_account="Payment Account - _TC", | ||
loan_account="Loan Account - _TC", | ||
interest_income_account="Interest Income Account - _TC", | ||
penalty_income_account="Penalty Income Account - _TC", | ||
repayment_schedule_type="Monthly as per repayment start date", | ||
) | ||
|
||
payroll_period = create_payroll_period(name="_Test Payroll Period", company="_Test Company") | ||
|
||
make_salary_structure( | ||
"Test Loan Repayment Salary Structure", | ||
"Monthly", | ||
employee=applicant, | ||
company="_Test Company", | ||
currency="INR", | ||
payroll_period=payroll_period, | ||
) | ||
|
||
frappe.db.sql( | ||
"delete from tabLoan where applicant = '[email protected]'" | ||
) | ||
loan = create_loan( | ||
applicant, | ||
"Personal Loan", | ||
12000, | ||
"Repay Over Number of Periods", | ||
12, | ||
posting_date=payroll_period.start_date, | ||
) | ||
loan.repay_from_salary = 1 | ||
loan.submit() | ||
|
||
make_loan_disbursement_entry( | ||
loan.name, loan.loan_amount, disbursement_date=payroll_period.start_date | ||
) | ||
|
||
process_loan_interest_accrual_for_term_loans( | ||
posting_date=add_months(payroll_period.start_date, 12) | ||
) | ||
|
||
repayment_entry = create_repayment_entry( | ||
loan.name, applicant, add_months(payroll_period.start_date, 7), 7000 | ||
) | ||
repayment_entry.submit() | ||
|
||
we = make_loan_write_off( | ||
loan.name, posting_date=add_months(payroll_period.start_date, 8), amount=5000 | ||
) | ||
we.submit() | ||
|
||
self.assertEqual(frappe.db.get_value("Loan", loan.name, "status"), "Closed") | ||
|
||
ss = make_employee_salary_slip( | ||
applicant, | ||
"Monthly", | ||
"Test Loan Repayment Salary Structure", | ||
posting_date=add_months(payroll_period.start_date, 8), | ||
) | ||
ss.submit() | ||
|
||
self.assertEqual(ss.total_loan_repayment, 0) | ||
|
||
def test_multi_currency_salary_slip(self): | ||
from hrms.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure | ||
|
||
|