2
0
mirror of https://github.com/frappe/books.git synced 2024-12-25 20:11:15 +00:00

fix: Handle null table

This commit is contained in:
Faris Ansari 2020-05-06 23:48:19 +05:30
parent 1980e5e26f
commit c842334003

View File

@ -636,7 +636,7 @@ module.exports = class BaseDocument extends Observable {
// helper functions
getSum(tablefield, childfield) {
return this[tablefield]
return (this[tablefield] || [])
.map(d => parseFloat(d[childfield], 10) || 0)
.reduce((a, b) => a + b, 0);
}