fix: Loan repayment entries for payroll payable account
This commit is contained in:
parent
cb8cd7f5bc
commit
3128f9603e
@ -447,8 +447,6 @@ class LoanRepayment(AccountsController):
|
||||
"remarks": remarks,
|
||||
"cost_center": self.cost_center,
|
||||
"posting_date": getdate(self.posting_date),
|
||||
"party_type": self.applicant_type if self.repay_from_salary else "",
|
||||
"party": self.applicant if self.repay_from_salary else "",
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -16,6 +16,7 @@ from frappe.utils import (
|
||||
comma_and,
|
||||
date_diff,
|
||||
flt,
|
||||
get_link_to_form,
|
||||
getdate,
|
||||
)
|
||||
|
||||
@ -45,6 +46,7 @@ class PayrollEntry(Document):
|
||||
|
||||
def before_submit(self):
|
||||
self.validate_employee_details()
|
||||
self.validate_payroll_payable_account()
|
||||
if self.validate_attendance:
|
||||
if self.validate_employee_attendance():
|
||||
frappe.throw(_("Cannot Submit, Employees left to mark attendance"))
|
||||
@ -66,6 +68,14 @@ class PayrollEntry(Document):
|
||||
if len(emp_with_sal_slip):
|
||||
frappe.throw(_("Salary Slip already exists for {0}").format(comma_and(emp_with_sal_slip)))
|
||||
|
||||
def validate_payroll_payable_account(self):
|
||||
if frappe.db.get_value("Account", self.payroll_payable_account, "account_type"):
|
||||
frappe.throw(
|
||||
_(
|
||||
"Account type cannot be set for payroll payable account {0}, please remove and try again"
|
||||
).format(frappe.bold(get_link_to_form("Account", self.payroll_payable_account)))
|
||||
)
|
||||
|
||||
def on_cancel(self):
|
||||
frappe.delete_doc(
|
||||
"Salary Slip",
|
||||
|
Loading…
x
Reference in New Issue
Block a user