[Fix] break fieldtype issue in the auto email report, object split issue for the columns which has list and dictionary
This commit is contained in:
parent
ff9819ed8f
commit
fc454e014d
2 changed files with 18 additions and 1 deletions
|
|
@ -57,7 +57,14 @@ class Report(Document):
|
|||
if self.report_type in ('Query Report', 'Script Report'):
|
||||
# query and script reports
|
||||
data = frappe.desk.query_report.run(self.name, filters=filters, user=user)
|
||||
out.append([d.split(':')[0] for d in data.get('columns')])
|
||||
columns_list = []
|
||||
for d in data.get('columns'):
|
||||
if isinstance(d, dict):
|
||||
columns_list.append(d.get('label'))
|
||||
else:
|
||||
columns_list.append(d.split(':')[0])
|
||||
|
||||
out.append(columns_list)
|
||||
out += data.get('result')
|
||||
else:
|
||||
# standard report
|
||||
|
|
|
|||
|
|
@ -60,9 +60,19 @@ frappe.ui.form.on('Auto Email Report', {
|
|||
<tr><th style="width: 50%">'+__('Filter')+'</th><th>'+__('Value')+'</th></tr>\
|
||||
</thead><tbody></tbody></table>').appendTo(wrapper);
|
||||
$('<p class="text-muted small">' + __("Click table to edit") + '</p>').appendTo(wrapper);
|
||||
|
||||
var filters = JSON.parse(frm.doc.filters || '{}');
|
||||
var report_filters = frappe.query_reports[frm.doc.report].filters;
|
||||
|
||||
report_filters_list = []
|
||||
$.each(report_filters, function(key, val){
|
||||
// Remove break fieldtype from the filters
|
||||
if(val.fieldtype != 'Break') {
|
||||
report_filters_list.push(val)
|
||||
}
|
||||
})
|
||||
report_filters = report_filters_list;
|
||||
|
||||
report_filters.forEach(function(f) {
|
||||
$('<tr><td>' + f.label + '</td><td>'+ frappe.format(filters[f.fieldname], f) +'</td></tr>')
|
||||
.appendTo(table.find('tbody'));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue