Ver código fonte

Revert "[ Fix ] Totals row not popped before appending more data"

version-14
Rushabh Mehta 7 anos atrás
committed by GitHub
pai
commit
140177391b
1 arquivos alterados com 5 adições e 14 exclusões
  1. +5
    -14
      frappe/public/js/frappe/views/reports/reportview.js

+ 5
- 14
frappe/public/js/frappe/views/reports/reportview.js Ver arquivo

@@ -624,26 +624,17 @@ frappe.views.ReportView = frappe.ui.BaseList.extend({
this.data.pop(); this.data.pop();
} }


var existing_total_row = null;
if(this.add_totals_row) { if(this.add_totals_row) {
var totals_row = {_totals_row: 1}; var totals_row = {_totals_row: 1};
if(this.data.length) { if(this.data.length) {
this.data.forEach(function(row, ri) { this.data.forEach(function(row, ri) {
if(row._totals_row && !existing_total_row) {
existing_total_row = ri;
}
else {
$.each(row, function(key, value) {
if($.isNumeric(value)) {
totals_row[key] = (totals_row[key] || 0) + value;
}
});
}
$.each(row, function(key, value) {
if($.isNumeric(value)) {
totals_row[key] = (totals_row[key] || 0) + value;
}
});
}); });
} }
if(existing_total_row) {
this.data.splice(existing_total_row, 1);
}
this.data.push(totals_row); this.data.push(totals_row);
} }
}, },


Carregando…
Cancelar
Salvar