Merge pull request #24768 from ankush/salary_slip_error

chore: improve error message for missing fields.
This commit is contained in:
Marica 2021-03-09 18:23:09 +05:30 committed by GitHub
commit 916b75a3a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -506,7 +506,8 @@ class SalarySlip(TransactionBase):
return amount
except NameError as err:
frappe.throw(_("Name error: {0}").format(err))
frappe.throw(_("{0} <br> 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:
@ -930,7 +931,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} <br> 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:
@ -1242,4 +1244,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())
return policy_template.format(**employee.as_dict())