fix: show chart tool tip in report currency
This commit is contained in:
@@ -95,7 +95,7 @@ def execute(filters=None):
|
|||||||
filters.periodicity, period_list, filters.accumulated_values, company=filters.company
|
filters.periodicity, period_list, filters.accumulated_values, company=filters.company
|
||||||
)
|
)
|
||||||
|
|
||||||
chart = get_chart_data(filters, columns, asset, liability, equity)
|
chart = get_chart_data(filters, columns, asset, liability, equity, currency)
|
||||||
|
|
||||||
report_summary, primitive_summary = get_report_summary(
|
report_summary, primitive_summary = get_report_summary(
|
||||||
period_list, asset, liability, equity, provisional_profit_loss, currency, filters
|
period_list, asset, liability, equity, provisional_profit_loss, currency, filters
|
||||||
@@ -221,7 +221,7 @@ def get_report_summary(
|
|||||||
], (net_asset - net_liability + net_equity)
|
], (net_asset - net_liability + net_equity)
|
||||||
|
|
||||||
|
|
||||||
def get_chart_data(filters, columns, asset, liability, equity):
|
def get_chart_data(filters, columns, asset, liability, equity, currency):
|
||||||
labels = [d.get("label") for d in columns[2:]]
|
labels = [d.get("label") for d in columns[2:]]
|
||||||
|
|
||||||
asset_data, liability_data, equity_data = [], [], []
|
asset_data, liability_data, equity_data = [], [], []
|
||||||
@@ -249,4 +249,8 @@ def get_chart_data(filters, columns, asset, liability, equity):
|
|||||||
else:
|
else:
|
||||||
chart["type"] = "line"
|
chart["type"] = "line"
|
||||||
|
|
||||||
|
chart["fieldtype"] = "Currency"
|
||||||
|
chart["options"] = "currency"
|
||||||
|
chart["currency"] = currency
|
||||||
|
|
||||||
return chart
|
return chart
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ def execute(filters=None):
|
|||||||
)
|
)
|
||||||
columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company, True)
|
columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company, True)
|
||||||
|
|
||||||
chart = get_chart_data(columns, data)
|
chart = get_chart_data(columns, data, company_currency)
|
||||||
|
|
||||||
report_summary = get_report_summary(summary_data, company_currency)
|
report_summary = get_report_summary(summary_data, company_currency)
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ def get_report_summary(summary_data, currency):
|
|||||||
return report_summary
|
return report_summary
|
||||||
|
|
||||||
|
|
||||||
def get_chart_data(columns, data):
|
def get_chart_data(columns, data, currency):
|
||||||
labels = [d.get("label") for d in columns[2:]]
|
labels = [d.get("label") for d in columns[2:]]
|
||||||
print(data)
|
print(data)
|
||||||
datasets = [
|
datasets = [
|
||||||
@@ -277,5 +277,7 @@ def get_chart_data(columns, data):
|
|||||||
chart = {"data": {"labels": labels, "datasets": datasets}, "type": "bar"}
|
chart = {"data": {"labels": labels, "datasets": datasets}, "type": "bar"}
|
||||||
|
|
||||||
chart["fieldtype"] = "Currency"
|
chart["fieldtype"] = "Currency"
|
||||||
|
chart["options"] = "currency"
|
||||||
|
chart["currency"] = currency
|
||||||
|
|
||||||
return chart
|
return chart
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ def execute(filters=None):
|
|||||||
|
|
||||||
columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company)
|
columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company)
|
||||||
|
|
||||||
chart = get_chart_data(filters, columns, income, expense, net_profit_loss)
|
|
||||||
|
|
||||||
currency = filters.presentation_currency or frappe.get_cached_value(
|
currency = filters.presentation_currency or frappe.get_cached_value(
|
||||||
"Company", filters.company, "default_currency"
|
"Company", filters.company, "default_currency"
|
||||||
)
|
)
|
||||||
|
chart = get_chart_data(filters, columns, income, expense, net_profit_loss, currency)
|
||||||
|
|
||||||
report_summary, primitive_summary = get_report_summary(
|
report_summary, primitive_summary = get_report_summary(
|
||||||
period_list, filters.periodicity, income, expense, net_profit_loss, currency, filters
|
period_list, filters.periodicity, income, expense, net_profit_loss, currency, filters
|
||||||
)
|
)
|
||||||
@@ -152,7 +152,7 @@ def get_net_profit_loss(income, expense, period_list, company, currency=None, co
|
|||||||
return net_profit_loss
|
return net_profit_loss
|
||||||
|
|
||||||
|
|
||||||
def get_chart_data(filters, columns, income, expense, net_profit_loss):
|
def get_chart_data(filters, columns, income, expense, net_profit_loss, currency):
|
||||||
labels = [d.get("label") for d in columns[2:]]
|
labels = [d.get("label") for d in columns[2:]]
|
||||||
|
|
||||||
income_data, expense_data, net_profit = [], [], []
|
income_data, expense_data, net_profit = [], [], []
|
||||||
@@ -181,5 +181,7 @@ def get_chart_data(filters, columns, income, expense, net_profit_loss):
|
|||||||
chart["type"] = "line"
|
chart["type"] = "line"
|
||||||
|
|
||||||
chart["fieldtype"] = "Currency"
|
chart["fieldtype"] = "Currency"
|
||||||
|
chart["options"] = "currency"
|
||||||
|
chart["currency"] = currency
|
||||||
|
|
||||||
return chart
|
return chart
|
||||||
|
|||||||
Reference in New Issue
Block a user