From c0b4eea415ca3cb3a242f78f882e7ea0f811a836 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Thu, 25 Mar 2021 14:39:05 +0530 Subject: [PATCH] fix: sider --- .../report/profitability/profitability.py | 17 ++++++++--------- .../report/profitability/test_profitability.py | 3 +-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/erpnext/projects/report/profitability/profitability.py b/erpnext/projects/report/profitability/profitability.py index 8c052b5e17..8ce2eb09ee 100644 --- a/erpnext/projects/report/profitability/profitability.py +++ b/erpnext/projects/report/profitability/profitability.py @@ -4,7 +4,6 @@ from __future__ import unicode_literals import frappe from frappe import _ -from frappe.utils import nowdate, time_diff_in_hours def execute(filters=None): columns, data = [], [] @@ -25,31 +24,31 @@ def get_data(filters): (select si.customer_name,tabTimesheet.title,tabTimesheet.employee,si.grand_total,si.name as voucher_no, ss.gross_pay,ss.total_working_days,tabTimesheet.end_date,tabTimesheet.total_billed_hours,tabTimesheet.name as timesheet, - tabTimesheet.total_billed_hours/(ss.total_working_days * %s) as utilization + tabTimesheet.total_billed_hours/(ss.total_working_days * {0}) as utilization from `tabSalary Slip Timesheet` as sst join `tabTimesheet` on tabTimesheet.name = sst.time_sheet join `tabSales Invoice Timesheet` as sit on sit.time_sheet = tabTimesheet.name join `tabSales Invoice` as si on si.name = sit.parent and si.status != "Cancelled" - join `tabSalary Slip` as ss on ss.name = sst.parent and ss.status != "Cancelled" """%(default_working_hours) + join `tabSalary Slip` as ss on ss.name = sst.parent and ss.status != "Cancelled" """.format(default_working_hours) if conditions: sql += """ where - %s) as t"""%(conditions) + {0}) as t""".format(conditions) data = frappe.db.sql(sql,filters, as_dict=True) return data def get_conditions(filters): conditions = [] if filters.get("company"): - conditions.append("tabTimesheet.company='%s'"%filters.get("company")) + conditions.append('tabTimesheet.company="{0}"'.format(filters.get("company"))) if filters.get("customer_name"): - conditions.append("si.customer_name='%s'"%filters.get("customer_name")) + conditions.append("si.customer_name='{0}'".format(filters.get("customer_name"))) if filters.get("start_date"): - conditions.append("tabTimesheet.start_date>='%s'"%filters.get("start_date")) + conditions.append("tabTimesheet.start_date>='{0}'".format(filters.get("start_date"))) if filters.get("end_date"): - conditions.append("tabTimesheet.end_date<='%s'"%filters.get("end_date")) + conditions.append("tabTimesheet.end_date<='{0}'".format(filters.get("end_date"))) if filters.get("employee"): - conditions.append("tabTimesheet.employee='%s'"%filters.get("employee")) + conditions.append("tabTimesheet.employee='{0}'".format(filters.get("employee"))) conditions = " and ".join(conditions) return conditions diff --git a/erpnext/projects/report/profitability/test_profitability.py b/erpnext/projects/report/profitability/test_profitability.py index dfdef0dcec..64ab6787eb 100644 --- a/erpnext/projects/report/profitability/test_profitability.py +++ b/erpnext/projects/report/profitability/test_profitability.py @@ -1,8 +1,7 @@ from __future__ import unicode_literals import unittest import frappe -import datetime -from frappe.utils import getdate, nowdate, add_days, add_months +from frappe.utils import getdate, nowdate from erpnext.hr.doctype.employee.test_employee import make_employee from erpnext.projects.doctype.timesheet.test_timesheet import make_salary_structure_for_timesheet, make_timesheet from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_sales_invoice