From 5ac740b3cb888f7e5d3ce926a64ccdb9ae864a85 Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Thu, 30 Mar 2017 08:32:50 +0530 Subject: [PATCH] [Fix] From Date and To Date not to be auto calculated for Timesheet Salary --- erpnext/hr/doctype/salary_slip/salary_slip.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index c629e87571..34b729f102 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -21,7 +21,9 @@ class SalarySlip(TransactionBase): self.status = self.get_status() self.validate_dates() self.check_existing() - self.get_date_details() + if not self.salary_slip_based_on_timesheet: + self.get_date_details() + if not (len(self.get("earnings")) or len(self.get("deductions"))): # get details from salary structure self.get_emp_and_leave_details() @@ -121,7 +123,8 @@ class SalarySlip(TransactionBase): self.set("earnings", []) self.set("deductions", []) - self.get_date_details() + if not self.salary_slip_based_on_timesheet: + self.get_date_details() self.validate_dates() joining_date, relieving_date = frappe.db.get_value("Employee", self.employee, ["date_of_joining", "relieving_date"]) @@ -189,7 +192,8 @@ class SalarySlip(TransactionBase): def process_salary_structure(self): '''Calculate salary after salary structure details have been updated''' - self.get_date_details() + if not self.salary_slip_based_on_timesheet: + self.get_date_details() self.pull_emp_details() self.get_leave_details() self.calculate_net_pay()