From 7228e1af6e2bd45250438622acb3a13374e1023f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sat, 6 May 2017 12:45:37 +0530 Subject: [PATCH] Customer/Supplier Name in sales/purchase analytics (#8717) --- .../buying/page/purchase_analytics/purchase_analytics.js | 8 ++------ erpnext/selling/page/sales_analytics/sales_analytics.js | 8 +++++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js index 3e6f23bedebe..10d13213986c 100644 --- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js +++ b/erpnext/buying/page/purchase_analytics/purchase_analytics.js @@ -35,11 +35,7 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({ item_key: "supplier", parent_field: "parent_supplier_type", formatter: function(item) { - // return repl('%(value)s', { - // value: item.name, - // enc_value: encodeURIComponent(item.name) - // }); - return item.name; + return item.supplier_name ? item.supplier_name + " (" + item.name + ")" : item.name; } }, "Supplier": { @@ -47,7 +43,7 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({ show: false, item_key: "supplier", formatter: function(item) { - return item.name; + return item.supplier_name ? item.supplier_name + " (" + item.name + ")" : item.name; } }, "Item Group": { diff --git a/erpnext/selling/page/sales_analytics/sales_analytics.js b/erpnext/selling/page/sales_analytics/sales_analytics.js index 73793d43390a..bb47f988f493 100644 --- a/erpnext/selling/page/sales_analytics/sales_analytics.js +++ b/erpnext/selling/page/sales_analytics/sales_analytics.js @@ -34,14 +34,16 @@ erpnext.SalesAnalytics = frappe.views.TreeGridReport.extend({ show: true, item_key: "customer", parent_field: "parent_customer_group", - formatter: function(item) { return item.customer_name || item.name; } + formatter: function(item) { + return item.customer_name? item.customer_name + " (" + item.name + ")" : item.name; + } }, "Customer": { label: __("Customer"), show: false, item_key: "customer", formatter: function(item) { - return item.customer_name || item.name; + return item.customer_name? item.customer_name + " (" + item.name + ")" : item.name; } }, "Item Group": { @@ -67,7 +69,7 @@ erpnext.SalesAnalytics = frappe.views.TreeGridReport.extend({ item_key: "customer", parent_field: "parent_territory", formatter: function(item) { - return item.name; + return item.customer_name? item.customer_name + " (" + item.name + ")" : item.name; } } }