From e003cc881293219affef084ad72f76f7f8e4d26e Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Fri, 3 May 2019 16:41:04 +0530 Subject: [PATCH] fix: filter out completed purchase receipt --- .../procurement_tracker/procurement_tracker.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/buying/report/procurement_tracker/procurement_tracker.py b/erpnext/buying/report/procurement_tracker/procurement_tracker.py index 7889d95a19..2654cd4965 100644 --- a/erpnext/buying/report/procurement_tracker/procurement_tracker.py +++ b/erpnext/buying/report/procurement_tracker/procurement_tracker.py @@ -150,11 +150,10 @@ def get_conditions(filters): """% (filters.get('cost_center'), filters.get('project')) if filters.get("from_date"): - conditions.append("transaction_date>=%s", filters.get('from_date')) + conditions.append("AND transaction_date>=%s", filters.get('from_date')) if filters.get("to_date"): - conditions.append("transaction_date<=%s", filters.get('to_date') - + conditions.append("AND transaction_date<=%s", filters.get('to_date') return conditions def get_data(filters): @@ -227,12 +226,12 @@ def get_mapped_mr_details(conditions): def get_mapped_pi_records(): return frappe._dict(frappe.db.sql(""" SELECT - po_detail, - base_amount - FROM `tabPurchase Invoice Item` + pi_item.po_detail, + pi_item.base_amount + FROM `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item WHERE - docstatus=1 - AND po_detail IS NOT NULL + pi.docstatus=1 + AND pi_item.po_detail IS NOT NULL """)) def get_mapped_pr_records(): @@ -245,6 +244,7 @@ def get_mapped_pr_records(): pr.docstatus=1 AND pr.name=pr_item.parent AND pr_item.purchase_order_item IS NOT NULL + AND pr.status not in ("Closed","Completed","Cancelled") """)) def get_po_entries(conditions):