feat: added provision to disable rounded total for salary slips

This commit is contained in:
thefalconx33
2019-12-31 14:34:09 +05:30
parent 8f6a6e8d2a
commit cd2899f429

View File

@@ -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`