From 917e7c34aff47a59d53a759d08c7c2c2d57e1efb Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Tue, 10 May 2022 15:25:08 +0530 Subject: [PATCH] fix(charts): Pass fieldtype for chart data in selling reports (cherry picked from commit 7bf0e4f8e562f182bf0fc306552f33dfb33a193e) --- .../item_wise_sales_history/item_wise_sales_history.py | 1 + erpnext/selling/report/quotation_trends/quotation_trends.py | 1 + erpnext/selling/report/sales_analytics/sales_analytics.py | 5 +++++ .../selling/report/sales_order_trends/sales_order_trends.py | 1 + 4 files changed, 8 insertions(+) diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py index 12ca7b3ff83..a134b48ebc2 100644 --- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py +++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py @@ -238,4 +238,5 @@ def get_chart_data(data): "datasets": [{"name": _(" Total Sales Amount"), "values": datapoints[:30]}], }, "type": "bar", + "fieldtype": "Currency", } diff --git a/erpnext/selling/report/quotation_trends/quotation_trends.py b/erpnext/selling/report/quotation_trends/quotation_trends.py index dfcec22cca2..50902fbc2d6 100644 --- a/erpnext/selling/report/quotation_trends/quotation_trends.py +++ b/erpnext/selling/report/quotation_trends/quotation_trends.py @@ -54,4 +54,5 @@ def get_chart_data(data, conditions, filters): }, "type": "line", "lineOptions": {"regionFill": 1}, + "fieldtype": "Currency", } diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.py b/erpnext/selling/report/sales_analytics/sales_analytics.py index f1aada3e185..3f93d4b9659 100644 --- a/erpnext/selling/report/sales_analytics/sales_analytics.py +++ b/erpnext/selling/report/sales_analytics/sales_analytics.py @@ -416,3 +416,8 @@ class Analytics(object): else: labels = [d.get("label") for d in self.columns[1 : length - 1]] self.chart = {"data": {"labels": labels, "datasets": []}, "type": "line"} + + if self.filters["value_quantity"] == "Value": + self.chart["fieldtype"] = "Currency" + else: + self.chart["fieldtype"] = "Float" diff --git a/erpnext/selling/report/sales_order_trends/sales_order_trends.py b/erpnext/selling/report/sales_order_trends/sales_order_trends.py index 93707bd46d9..d34501e6825 100644 --- a/erpnext/selling/report/sales_order_trends/sales_order_trends.py +++ b/erpnext/selling/report/sales_order_trends/sales_order_trends.py @@ -53,4 +53,5 @@ def get_chart_data(data, conditions, filters): }, "type": "line", "lineOptions": {"regionFill": 1}, + "fieldtype": "Currency", }