diff --git a/controllers/trends.py b/controllers/trends.py index acbc744ae6..2cdccb182d 100644 --- a/controllers/trends.py +++ b/controllers/trends.py @@ -35,7 +35,7 @@ def get_columns(filters, trans): ["Total(Qty):Float:120", "Total(Amt):Currency:120"] conditions = {"based_on_select": based_on_details["based_on_select"], "period_wise_select": period_select, - "columns": columns, "group_by": based_on_details["based_on_group_by"], "grbc": group_by_cols, "trans": trans, + "columns": columns, "group_by": based_on_details["based_on_group_by"], "grbc": group_by_cols, "trans": trans, "addl_tables": based_on_details["addl_tables"]} return conditions @@ -72,8 +72,8 @@ def get_data(filters, conditions): else : inc = 1 data1 = webnotes.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s - where t2.parent = t1.name and t1.company = %s - and t1.fiscal_year = %s and t1.docstatus = 1 %s + where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s and + t1.docstatus = 1 %s group by %s """ % (query_details, conditions["trans"], conditions["trans"], conditions["addl_tables"], "%s", "%s", cond, conditions["group_by"]), (filters.get("company"), @@ -110,10 +110,9 @@ def get_data(filters, conditions): data.append(des) else: - webnotes.errprint(["hii", conditions["addl_tables"]]) data = webnotes.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s - where t2.parent = t1.name and t1.company = %s - and t1.fiscal_year = %s and t1.docstatus = 1 %s + where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s and + t1.docstatus = 1 %s group by %s """%(query_details, conditions["trans"], conditions["trans"], conditions["addl_tables"], "%s", "%s", cond,conditions["group_by"]), (filters.get("company"), diff --git a/selling/page/selling_home/selling_home.js b/selling/page/selling_home/selling_home.js index 87e12db904..91649e39c8 100644 --- a/selling/page/selling_home/selling_home.js +++ b/selling/page/selling_home/selling_home.js @@ -190,6 +190,10 @@ wn.module_page["Selling"] = [ route: "query-report/Sales Order Trends", doctype: "Sales Order" }, + { + "label":wn._("Pending SO Items For Purchase Request"), + route: "query-report/Pending SO Items For Purchase Request" + }, ] } ] diff --git a/selling/report/pending_so_items_for_purchase_request/__init__.py b/selling/report/pending_so_items_for_purchase_request/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.txt b/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.txt new file mode 100644 index 0000000000..080e4556c1 --- /dev/null +++ b/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.txt @@ -0,0 +1,22 @@ +[ + { + "creation": "2013-06-21 12:07:36", + "docstatus": 0, + "modified": "2013-06-21 14:47:37", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "query": "select \n so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"S.O. Date:Date:120\",\n mr.name as \"Request ID:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n so_item.qty as \"S.O. Qty:Float:100 \",\n SUM(mr_item.qty) as \"Requested Qty:Float:100\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n so_item.`parent` = so.`name` and so.docstatus = 1 \n and so.status != \"Stopped\" and mr_item.parent = mr.name\n and mr.status != \"Stopped\" and mr.docstatus = 1\n and mr_item.sales_order_no = so.name\ngroup by so.name\norder by so_item.item_code asc, so.`transaction_date`", + "ref_doctype": "Sales Order", + "report_name": "Pending SO Items For Purchase Request", + "report_type": "Query Report" + }, + { + "doctype": "Report", + "name": "Pending SO Items For Purchase Request" + } +] \ No newline at end of file