From 385e22a06725f73a45f60aeb88620bade89ba528 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Fri, 27 May 2022 12:57:07 +0530 Subject: [PATCH] fix: Gratuity status not updated on salary slip submission --- erpnext/payroll/doctype/salary_slip/salary_slip.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.py b/erpnext/payroll/doctype/salary_slip/salary_slip.py index 6a7f72b01329..f4f84155af99 100644 --- a/erpnext/payroll/doctype/salary_slip/salary_slip.py +++ b/erpnext/payroll/doctype/salary_slip/salary_slip.py @@ -116,10 +116,10 @@ def on_submit(self): self.update_payment_status_for_gratuity() def update_payment_status_for_gratuity(self): - add_salary = frappe.db.get_all( + additional_salary = frappe.db.get_all( "Additional Salary", filters={ - "payroll_date": ("BETWEEN", [self.start_date, self.end_date]), + "payroll_date": ("between", [self.start_date, self.end_date]), "employee": self.employee, "ref_doctype": "Gratuity", "docstatus": 1, @@ -128,10 +128,10 @@ def update_payment_status_for_gratuity(self): limit=1, ) - if len(add_salary): + if additional_salary: status = "Paid" if self.docstatus == 1 else "Unpaid" - if add_salary[0].name in [data.additional_salary for data in self.earnings]: - frappe.db.set_value("Gratuity", add_salary.ref_docname, "status", status) + if additional_salary[0].name in [entry.additional_salary for entry in self.earnings]: + frappe.db.set_value("Gratuity", additional_salary[0].ref_docname, "status", status) def on_cancel(self): self.set_status()