From 9b4e5bfa87786ccf1e8815b270066db20237875a Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 1 Mar 2021 10:44:21 +0530 Subject: [PATCH] chore: improve error message for missing fields. --- erpnext/payroll/doctype/salary_slip/salary_slip.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.py b/erpnext/payroll/doctype/salary_slip/salary_slip.py index 60aff02b38..deaa209658 100644 --- a/erpnext/payroll/doctype/salary_slip/salary_slip.py +++ b/erpnext/payroll/doctype/salary_slip/salary_slip.py @@ -504,7 +504,8 @@ class SalarySlip(TransactionBase): return amount except NameError as err: - frappe.throw(_("Name error: {0}").format(err)) + frappe.throw(_("{0}
This error can be due to missing or deleted field.").format(err), + title=_("Name error")) except SyntaxError as err: frappe.throw(_("Syntax error in formula or condition: {0}").format(err)) except Exception as e: @@ -928,7 +929,8 @@ class SalarySlip(TransactionBase): if condition: return frappe.safe_eval(condition, self.whitelisted_globals, data) except NameError as err: - frappe.throw(_("Name error: {0}").format(err)) + frappe.throw(_("{0}
This error can be due to missing or deleted field.").format(err), + title=_("Name error")) except SyntaxError as err: frappe.throw(_("Syntax error in condition: {0}").format(err)) except Exception as e: @@ -1223,4 +1225,4 @@ def unlink_ref_doc_from_salary_slip(ref_no): def generate_password_for_pdf(policy_template, employee): employee = frappe.get_doc("Employee", employee) - return policy_template.format(**employee.as_dict()) \ No newline at end of file + return policy_template.format(**employee.as_dict())