From 42f2d1a7a8b88a76679ccbfbbec9b7ca41974a3a Mon Sep 17 00:00:00 2001 From: Zarrar Date: Wed, 20 Jun 2018 10:50:11 +0530 Subject: [PATCH] fix incase no customer fetched (#14596) --- erpnext/projects/doctype/timesheet/timesheet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 98e961d97f..d2f18682a0 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -420,9 +420,10 @@ def get_timesheets_list(doctype, txt, filters, limit_start, limit_page_length=20 # find customer name from contact. customer = frappe.db.sql('''SELECT dl.link_name FROM `tabContact` AS c inner join \ `tabDynamic Link` AS dl ON c.first_name=dl.link_name WHERE c.email_id=%s''',user) - # find list of Sales Invoice for made for customer. - sales_invoice = frappe.db.sql('''SELECT name FROM `tabSales Invoice` WHERE customer = %s''',customer) + if customer: + # find list of Sales Invoice for made for customer. + sales_invoice = frappe.db.sql('''SELECT name FROM `tabSales Invoice` WHERE customer = %s''',customer) # Return timesheet related data to web portal. return frappe. db.sql('''SELECT ts.name, tsd.activity_type, ts.status, ts.total_billable_hours, \ tsd.sales_invoice, tsd.project FROM `tabTimesheet` AS ts inner join `tabTimesheet Detail` \