From cd2899f4293eeab1c374cd62f556ababee60b314 Mon Sep 17 00:00:00 2001 From: thefalconx33 Date: Tue, 31 Dec 2019 14:34:09 +0530 Subject: [PATCH] feat: added provision to disable rounded total for salary slips --- erpnext/hr/doctype/salary_slip/salary_slip.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 46be4fe2873..555f74c64aa 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -50,7 +50,8 @@ class SalarySlip(TransactionBase): self.calculate_net_pay() company_currency = erpnext.get_company_currency(self.company) - self.total_in_words = money_in_words(self.rounded_total, company_currency) + total = self.net_pay if self.is_rounding_total_disabled() else self.rounded_total + self.total_in_words = money_in_words(total, company_currency) if frappe.db.get_single_value("HR Settings", "max_working_hours_against_timesheet"): max_working_hours = frappe.db.get_single_value("HR Settings", "max_working_hours_against_timesheet") @@ -90,6 +91,9 @@ class SalarySlip(TransactionBase): if date_diff(self.end_date, self.start_date) < 0: frappe.throw(_("To date cannot be before From date")) + def is_rounding_total_disabled(self): + return cint(frappe.db.get_single_value("HR Settings", "disable_rounded_total")) + def check_existing(self): if not self.salary_slip_based_on_timesheet: ret_exist = frappe.db.sql("""select name from `tabSalary Slip`