Fixed version conflict
This commit is contained in:
@@ -8,6 +8,7 @@ from frappe import _
|
||||
|
||||
import json
|
||||
from datetime import timedelta
|
||||
from erpnext.controllers.queries import get_match_cond
|
||||
from frappe.utils import flt, time_diff_in_hours, get_datetime, getdate, cint, get_datetime_str
|
||||
from frappe.model.document import Document
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
@@ -20,6 +21,7 @@ class OverProductionLoggedError(frappe.ValidationError): pass
|
||||
|
||||
class Timesheet(Document):
|
||||
def validate(self):
|
||||
self.set_employee_name()
|
||||
self.set_status()
|
||||
self.validate_dates()
|
||||
self.validate_time_logs()
|
||||
@@ -27,6 +29,10 @@ class Timesheet(Document):
|
||||
self.calculate_total_amounts()
|
||||
self.calculate_percentage_billed()
|
||||
|
||||
def set_employee_name(self):
|
||||
if self.employee and not self.employee_name:
|
||||
self.employee_name = frappe.db.get_value('Employee', self.employee, 'employee_name')
|
||||
|
||||
def calculate_total_amounts(self):
|
||||
self.total_hours = 0.0
|
||||
self.total_billable_hours = 0.0
|
||||
@@ -360,10 +366,14 @@ def get_events(start, end, filters=None):
|
||||
filters = json.loads(filters)
|
||||
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""select `tabTimesheet Detail`.name as name, `tabTimesheet Detail`.docstatus as status, `tabTimesheet Detail`.parent as parent,
|
||||
from_time, hours, activity_type, project, to_time from `tabTimesheet Detail`,
|
||||
`tabTimesheet` where `tabTimesheet Detail`.parent = `tabTimesheet`.name and `tabTimesheet`.docstatus < 2 and
|
||||
(from_time between %(start)s and %(end)s) {conditions}""".format(conditions=conditions),
|
||||
return frappe.db.sql("""select `tabTimesheet Detail`.name as name,
|
||||
`tabTimesheet Detail`.docstatus as status, `tabTimesheet Detail`.parent as parent,
|
||||
from_time, hours, activity_type, project, to_time
|
||||
from `tabTimesheet Detail`, `tabTimesheet`
|
||||
where `tabTimesheet Detail`.parent = `tabTimesheet`.name
|
||||
and `tabTimesheet`.docstatus < 2
|
||||
and (from_time between %(start)s and %(end)s) {conditions} {match_cond}
|
||||
""".format(conditions=conditions, match_cond = get_match_cond('Timesheet')),
|
||||
{
|
||||
"start": start,
|
||||
"end": end
|
||||
|
||||
Reference in New Issue
Block a user