Merge branch 'develop' into fix-employee-onboarding-status

This commit is contained in:
Rucha Mahabal
2021-06-24 12:24:44 +05:30
committed by GitHub
716 changed files with 10532 additions and 16865 deletions

View File

@@ -232,7 +232,7 @@ def get_project(doctype, txt, searchfield, start, page_len, filters):
meta = frappe.get_meta(doctype)
searchfields = meta.get_search_fields()
search_columns = ", " + ", ".join(searchfields) if searchfields else ''
search_cond = " or " + " or ".join([field + " like %(txt)s" for field in searchfields])
search_cond = " or " + " or ".join(field + " like %(txt)s" for field in searchfields)
return frappe.db.sql(""" select name {search_columns} from `tabProject`
where %(key)s like %(txt)s

View File

@@ -87,8 +87,8 @@ class Timesheet(Document):
def set_dates(self):
if self.docstatus < 2 and self.time_logs:
start_date = min([getdate(d.from_time) for d in self.time_logs])
end_date = max([getdate(d.to_time) for d in self.time_logs])
start_date = min(getdate(d.from_time) for d in self.time_logs)
end_date = max(getdate(d.to_time) for d in self.time_logs)
if start_date and end_date:
self.start_date = getdate(start_date)

View File

@@ -1,7 +1,7 @@
from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import getdate, nowdate
from frappe.utils import getdate, nowdate, add_days
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
@@ -16,17 +16,22 @@ class TestProjectProfitability(unittest.TestCase):
make_salary_structure_for_timesheet(emp, company='_Test Company')
self.timesheet = make_timesheet(emp, simulate = True, is_billable=1)
self.salary_slip = make_salary_slip(self.timesheet.name)
holidays = self.salary_slip.get_holidays_for_employee(nowdate(), nowdate())
if holidays:
frappe.db.set_value('Payroll Settings', None, 'include_holidays_in_total_working_days', 1)
self.salary_slip.submit()
self.sales_invoice = make_sales_invoice(self.timesheet.name, '_Test Item', '_Test Customer')
self.sales_invoice.due_date = nowdate()
self.sales_invoice.submit()
frappe.db.set_value('HR Settings', None, 'standard_working_hours', 8)
frappe.db.set_value('Payroll Settings', None, 'include_holidays_in_total_working_days', 0)
def test_project_profitability(self):
filters = {
'company': '_Test Company',
'start_date': getdate(),
'start_date': add_days(getdate(), -3),
'end_date': getdate()
}

View File

@@ -122,7 +122,7 @@ def get_report_summary(data):
if not data:
return None
avg_completion = sum([project.percent_complete for project in data]) / len(data)
avg_completion = sum(project.percent_complete for project in data) / len(data)
total = sum([project.total_tasks for project in data])
total_overdue = sum([project.overdue_tasks for project in data])
completed = sum([project.completed_tasks for project in data])