Merge pull request #31077 from deepeshgarg007/payroll_payable_party_type
fix: Loan repayment entries for payroll payable account
This commit is contained in:
commit
e75c843dc1
@ -448,8 +448,6 @@ class LoanRepayment(AccountsController):
|
|||||||
"remarks": remarks,
|
"remarks": remarks,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
"posting_date": getdate(self.posting_date),
|
"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,
|
comma_and,
|
||||||
date_diff,
|
date_diff,
|
||||||
flt,
|
flt,
|
||||||
|
get_link_to_form,
|
||||||
getdate,
|
getdate,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ class PayrollEntry(Document):
|
|||||||
|
|
||||||
def before_submit(self):
|
def before_submit(self):
|
||||||
self.validate_employee_details()
|
self.validate_employee_details()
|
||||||
|
self.validate_payroll_payable_account()
|
||||||
if self.validate_attendance:
|
if self.validate_attendance:
|
||||||
if self.validate_employee_attendance():
|
if self.validate_employee_attendance():
|
||||||
frappe.throw(_("Cannot Submit, Employees left to mark attendance"))
|
frappe.throw(_("Cannot Submit, Employees left to mark attendance"))
|
||||||
@ -66,6 +68,14 @@ class PayrollEntry(Document):
|
|||||||
if len(emp_with_sal_slip):
|
if len(emp_with_sal_slip):
|
||||||
frappe.throw(_("Salary Slip already exists for {0}").format(comma_and(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):
|
def on_cancel(self):
|
||||||
frappe.delete_doc(
|
frappe.delete_doc(
|
||||||
"Salary Slip",
|
"Salary Slip",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user