Skip to content

Commit

Permalink
fix(charts): Pass fieldtype for chart data in selling reports
Browse files Browse the repository at this point in the history
(cherry picked from commit 7bf0e4f)
  • Loading branch information
gavindsouza authored and mergify[bot] committed May 10, 2022
1 parent f64ba80 commit 917e7c3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,5 @@ def get_chart_data(data):
"datasets": [{"name": _(" Total Sales Amount"), "values": datapoints[:30]}],
},
"type": "bar",
"fieldtype": "Currency",
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ def get_chart_data(data, conditions, filters):
},
"type": "line",
"lineOptions": {"regionFill": 1},
"fieldtype": "Currency",
}
5 changes: 5 additions & 0 deletions erpnext/selling/report/sales_analytics/sales_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,8 @@ def get_chart_data(self):
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"
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ def get_chart_data(data, conditions, filters):
},
"type": "line",
"lineOptions": {"regionFill": 1},
"fieldtype": "Currency",
}

0 comments on commit 917e7c3

Please sign in to comment.