fix: Loan repayment via Salary Slip

This commit is contained in:
Deepesh Garg
2022-02-08 22:56:14 +05:30
parent 8cadc2668d
commit 2572480554
3 changed files with 6 additions and 4 deletions

View File

@@ -346,7 +346,7 @@ class LoanRepayment(AccountsController):
gle_map.append(
self.get_gl_dict({
"account": loan_details.penalty_income_account,
"against": payment_account,
"against": loan_details.loan_account,
"credit": self.total_penalty_paid,
"credit_in_account_currency": self.total_penalty_paid,
"against_voucher_type": "Loan",
@@ -368,7 +368,9 @@ class LoanRepayment(AccountsController):
"against_voucher": self.against_loan,
"remarks": remarks,
"cost_center": self.cost_center,
"posting_date": getdate(self.posting_date)
"posting_date": getdate(self.posting_date),
"party_type": loan_details.applicant_type if self.repay_from_salary else '',
"party": loan_details.applicant if self.repay_from_salary else ''
})
)

View File

@@ -125,7 +125,7 @@ class TestPayrollEntry(unittest.TestCase):
if not frappe.db.exists("Account", "_Test Payroll Payable - _TC"):
create_account(account_name="_Test Payroll Payable",
company="_Test Company", parent_account="Current Liabilities - _TC")
company="_Test Company", parent_account="Current Liabilities - _TC", account_type=None)
if not frappe.db.get_value("Company", "_Test Company", "default_payroll_payable_account") or \
frappe.db.get_value("Company", "_Test Company", "default_payroll_payable_account") != "_Test Payroll Payable - _TC":

View File

@@ -730,7 +730,7 @@ def get_salary_component_account(sal_comp, company_list=None):
})
sal_comp.save()
def create_account(account_name, company, parent_account):
def create_account(account_name, company, parent_account, account_type=None):
company_abbr = frappe.get_cached_value('Company', company, 'abbr')
account = frappe.db.get_value("Account", account_name + " - " + company_abbr)
if not account: