Analytics report bug fixes and code cleaning
This commit is contained in:
parent
305c8b1fba
commit
1a1c013b2a
@ -68,12 +68,6 @@ frappe.query_reports["Purchase Analytics"] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"formatter": function(value, row, column, data) {
|
|
||||||
if(!value){
|
|
||||||
value = 0
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
},
|
|
||||||
get_datatable_options(options) {
|
get_datatable_options(options) {
|
||||||
return Object.assign(options, {
|
return Object.assign(options, {
|
||||||
checkboxColumn: true,
|
checkboxColumn: true,
|
||||||
@ -113,16 +107,16 @@ frappe.query_reports["Purchase Analytics"] = {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
frappe.query_report.chart.update(new_data)
|
frappe.query_report.chart.update(new_data)
|
||||||
},200)
|
},500)
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
frappe.query_report.chart.draw(true);
|
frappe.query_report.chart.draw(true);
|
||||||
}, 800)
|
}, 1000)
|
||||||
|
|
||||||
frappe.query_report.raw_chart_data = new_data;
|
frappe.query_report.raw_chart_data = new_data;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,5 @@ frappe.query_reports["Production Analytics"] = {
|
|||||||
default: "Monthly",
|
default: "Monthly",
|
||||||
reqd: 1
|
reqd: 1
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"formatter": function(value, row, column, data) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -106,12 +106,12 @@ frappe.query_reports["Sales Analytics"] = {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
frappe.query_report.chart.update(new_data)
|
frappe.query_report.chart.update(new_data)
|
||||||
},200)
|
}, 500)
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
frappe.query_report.chart.draw(true);
|
frappe.query_report.chart.draw(true);
|
||||||
}, 800)
|
}, 1000)
|
||||||
|
|
||||||
frappe.query_report.raw_chart_data = new_data;
|
frappe.query_report.raw_chart_data = new_data;
|
||||||
},
|
},
|
||||||
|
@ -212,11 +212,11 @@ class Analytics(object):
|
|||||||
|
|
||||||
def get_period(self, posting_date):
|
def get_period(self, posting_date):
|
||||||
if self.filters.range == 'Weekly':
|
if self.filters.range == 'Weekly':
|
||||||
period = "Week " + str(posting_date.isocalendar()[1])
|
period = "Week " + str(posting_date.isocalendar()[1]) + " " + str(posting_date.year)
|
||||||
elif self.filters.range == 'Monthly':
|
elif self.filters.range == 'Monthly':
|
||||||
period = self.months[posting_date.month - 1]
|
period = str(self.months[posting_date.month - 1]) + " " + str(posting_date.year)
|
||||||
elif self.filters.range == 'Quarterly':
|
elif self.filters.range == 'Quarterly':
|
||||||
period = "Quarter " + str(((posting_date.month-1)//3)+1)
|
period = "Quarter " + str(((posting_date.month-1)//3)+1) +" " + str(posting_date.year)
|
||||||
else:
|
else:
|
||||||
year = get_fiscal_year(posting_date, company=self.filters.company)
|
year = get_fiscal_year(posting_date, company=self.filters.company)
|
||||||
period = str(year[2])
|
period = str(year[2])
|
||||||
@ -277,11 +277,14 @@ class Analytics(object):
|
|||||||
def get_chart_data(self):
|
def get_chart_data(self):
|
||||||
length = len(self.columns)
|
length = len(self.columns)
|
||||||
labels = [d.get("label") for d in self.columns[2:length-1]]
|
labels = [d.get("label") for d in self.columns[2:length-1]]
|
||||||
|
entry = {
|
||||||
|
'name':self.data[0].get('entity_name')
|
||||||
|
}
|
||||||
|
print("##########")
|
||||||
self.chart = {
|
self.chart = {
|
||||||
"data": {
|
"data": {
|
||||||
'labels': labels,
|
'labels': labels,
|
||||||
'datasets':[
|
'datasets':[]
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"type": "line"
|
"type": "line"
|
||||||
}
|
}
|
@ -71,17 +71,6 @@ frappe.query_reports["Stock Analytics"] = {
|
|||||||
reqd: 1
|
reqd: 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"formatter": function(value, row, column, data) {
|
|
||||||
if(!value && (column.fieldname == 'brand' || column.fieldname == 'uom')){
|
|
||||||
value = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Number(value)){
|
|
||||||
value = value.toFixed(2)
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
},
|
|
||||||
get_datatable_options(options) {
|
get_datatable_options(options) {
|
||||||
return Object.assign(options, {
|
return Object.assign(options, {
|
||||||
checkboxColumn: true,
|
checkboxColumn: true,
|
||||||
@ -120,16 +109,16 @@ frappe.query_reports["Stock Analytics"] = {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
frappe.query_report.chart.update(new_data)
|
frappe.query_report.chart.update(new_data)
|
||||||
},200)
|
},500)
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
frappe.query_report.chart.draw(true);
|
frappe.query_report.chart.draw(true);
|
||||||
}, 800)
|
}, 1000)
|
||||||
|
|
||||||
frappe.query_report.raw_chart_data = new_data;
|
frappe.query_report.raw_chart_data = new_data;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,11 +99,11 @@ def get_period(posting_date, filters):
|
|||||||
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
||||||
|
|
||||||
if filters.range == 'Weekly':
|
if filters.range == 'Weekly':
|
||||||
period = "Week " + str(posting_date.isocalendar()[1])
|
period = "Week " + str(posting_date.isocalendar()[1]) + " " + str(posting_date.year)
|
||||||
elif filters.range == 'Monthly':
|
elif filters.range == 'Monthly':
|
||||||
period = months[posting_date.month - 1]
|
period = str(months[posting_date.month - 1]) + " " + str(posting_date.year)
|
||||||
elif filters.range == 'Quarterly':
|
elif filters.range == 'Quarterly':
|
||||||
period = "Quarter " + str(((posting_date.month-1)//3)+1)
|
period = "Quarter " + str(((posting_date.month-1)//3)+1) +" " + str(posting_date.year)
|
||||||
else:
|
else:
|
||||||
year = get_fiscal_year(posting_date, company=filters.company)
|
year = get_fiscal_year(posting_date, company=filters.company)
|
||||||
period = str(year[2])
|
period = str(year[2])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user