From d62fa84ed983f7395e622d25a7f8760c1bfa0ffd Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 25 Jul 2017 15:34:20 +0530 Subject: [PATCH] [Fix] Calendar view for sales order --- .../selling/doctype/sales_order/sales_order.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 72b1154dd3..fd80dc8662 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -627,14 +627,15 @@ def get_events(start, end, filters=None): data = frappe.db.sql(""" select - so.name, so.customer_name, so.status, - so.delivery_status, so.billing_status, so_item.delivery_date + `tabSales Order`.name, `tabSales Order`.customer_name, `tabSales Order`.status, + `tabSales Order`.delivery_status, `tabSales Order`.billing_status, + `tabSales Order Item`.delivery_date from - `tabSales Order` so, `tabSales Order Item` so_item - where so.name = so_item.parent - and (ifnull(so_item.delivery_date, '0000-00-00')!= '0000-00-00') \ - and (so_item.delivery_date between %(start)s and %(end)s) - and so.docstatus < 2 + `tabSales Order`, `tabSales Order Item` + where `tabSales Order`.name = `tabSales Order Item`.parent + and (ifnull(`tabSales Order Item`.delivery_date, '0000-00-00')!= '0000-00-00') \ + and (`tabSales Order Item`.delivery_date between %(start)s and %(end)s) + and `tabSales Order`.docstatus < 2 {conditions} """.format(conditions=conditions), { "start": start,