mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
Merge pull request #22365 from frappe/mergify/bp/version-12-hotfix/pr-22350
fix: Skipping total row for tree-view reports (bp #22350)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"add_total_row": 0,
|
"add_total_row": 1,
|
||||||
"creation": "2018-09-21 12:46:29.451048",
|
"creation": "2018-09-21 12:46:29.451048",
|
||||||
"disable_prepared_report": 0,
|
"disable_prepared_report": 0,
|
||||||
"disabled": 0,
|
"disabled": 0,
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2020-04-30 19:49:02.303320",
|
"modified": "2020-06-19 17:41:03.132101",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Sales Analytics",
|
"name": "Sales Analytics",
|
||||||
|
|||||||
@@ -23,7 +23,14 @@ class Analytics(object):
|
|||||||
self.get_columns()
|
self.get_columns()
|
||||||
self.get_data()
|
self.get_data()
|
||||||
self.get_chart_data()
|
self.get_chart_data()
|
||||||
return self.columns, self.data, None, self.chart
|
|
||||||
|
# Skipping total row for tree-view reports
|
||||||
|
skip_total_row = 0
|
||||||
|
|
||||||
|
if self.filters.tree_type in ["Supplier Group", "Item Group", "Customer Group", "Territory"]:
|
||||||
|
skip_total_row = 1
|
||||||
|
|
||||||
|
return self.columns, self.data, None, self.chart, None, skip_total_row
|
||||||
|
|
||||||
def get_columns(self):
|
def get_columns(self):
|
||||||
self.columns = [{
|
self.columns = [{
|
||||||
@@ -194,9 +201,6 @@ class Analytics(object):
|
|||||||
def get_rows(self):
|
def get_rows(self):
|
||||||
self.data = []
|
self.data = []
|
||||||
self.get_periodic_data()
|
self.get_periodic_data()
|
||||||
total_row = {
|
|
||||||
"entity": "Total",
|
|
||||||
}
|
|
||||||
|
|
||||||
for entity, period_data in iteritems(self.entity_periodic_data):
|
for entity, period_data in iteritems(self.entity_periodic_data):
|
||||||
row = {
|
row = {
|
||||||
@@ -210,9 +214,6 @@ class Analytics(object):
|
|||||||
row[scrub(period)] = amount
|
row[scrub(period)] = amount
|
||||||
total += amount
|
total += amount
|
||||||
|
|
||||||
if not total_row.get(scrub(period)): total_row[scrub(period)] = 0
|
|
||||||
total_row[scrub(period)] += amount
|
|
||||||
|
|
||||||
row["total"] = total
|
row["total"] = total
|
||||||
|
|
||||||
if self.filters.tree_type == "Item":
|
if self.filters.tree_type == "Item":
|
||||||
@@ -220,8 +221,6 @@ class Analytics(object):
|
|||||||
|
|
||||||
self.data.append(row)
|
self.data.append(row)
|
||||||
|
|
||||||
self.data.append(total_row)
|
|
||||||
|
|
||||||
def get_rows_by_group(self):
|
def get_rows_by_group(self):
|
||||||
self.get_periodic_data()
|
self.get_periodic_data()
|
||||||
out = []
|
out = []
|
||||||
|
|||||||
@@ -33,21 +33,6 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
report = execute(filters)
|
report = execute(filters)
|
||||||
|
|
||||||
expected_data = [
|
expected_data = [
|
||||||
{
|
|
||||||
'entity': 'Total',
|
|
||||||
'apr_2017': 0.0,
|
|
||||||
'may_2017': 0.0,
|
|
||||||
'jun_2017': 2000.0,
|
|
||||||
'jul_2017': 1000.0,
|
|
||||||
'aug_2017': 0.0,
|
|
||||||
'sep_2017': 1500.0,
|
|
||||||
'oct_2017': 1000.0,
|
|
||||||
'nov_2017': 0.0,
|
|
||||||
'dec_2017': 0.0,
|
|
||||||
'jan_2018': 0.0,
|
|
||||||
'feb_2018': 2000.0,
|
|
||||||
'mar_2018': 0.0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"entity": "_Test Customer 1",
|
"entity": "_Test Customer 1",
|
||||||
"entity_name": "_Test Customer 1",
|
"entity_name": "_Test Customer 1",
|
||||||
@@ -149,21 +134,6 @@ class TestAnalytics(unittest.TestCase):
|
|||||||
report = execute(filters)
|
report = execute(filters)
|
||||||
|
|
||||||
expected_data = [
|
expected_data = [
|
||||||
{
|
|
||||||
'entity': 'Total',
|
|
||||||
'apr_2017': 0.0,
|
|
||||||
'may_2017': 0.0,
|
|
||||||
'jun_2017': 20.0,
|
|
||||||
'jul_2017': 10.0,
|
|
||||||
'aug_2017': 0.0,
|
|
||||||
'sep_2017': 15.0,
|
|
||||||
'oct_2017': 10.0,
|
|
||||||
'nov_2017': 0.0,
|
|
||||||
'dec_2017': 0.0,
|
|
||||||
'jan_2018': 0.0,
|
|
||||||
'feb_2018': 20.0,
|
|
||||||
'mar_2018': 0.0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"entity": "_Test Customer 1",
|
"entity": "_Test Customer 1",
|
||||||
"entity_name": "_Test Customer 1",
|
"entity_name": "_Test Customer 1",
|
||||||
|
|||||||
Reference in New Issue
Block a user