fix: Handle row which can be dict while printing (#7163)

This commit is contained in:
Faris Ansari 2019-03-29 23:03:42 +05:30 committed by GitHub
parent 4bfec7ca19
commit b48755a9a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -859,13 +859,18 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
align,
compareValue: compareFn,
format: (value, row, column, data) => {
const d = row.reduce((acc, curr) => {
if (!curr.column.docfield) return acc;
acc[curr.column.docfield.fieldname] = curr.content;
return acc;
}, {});
let doc = null;
if (Array.isArray(row)) {
doc = row.reduce((acc, curr) => {
if (!curr.column.docfield) return acc;
acc[curr.column.docfield.fieldname] = curr.content;
return acc;
}, {});
} else {
doc = row;
}
return frappe.format(value, column.docfield, { always_show_decimals: true }, d);
return frappe.format(value, column.docfield, { always_show_decimals: true }, doc);
}
};
}