mirror of
https://github.com/frappe/books.git
synced 2024-12-26 12:28:12 +00:00
fix: Handle null table
This commit is contained in:
parent
1980e5e26f
commit
c842334003
@ -636,7 +636,7 @@ module.exports = class BaseDocument extends Observable {
|
|||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
getSum(tablefield, childfield) {
|
getSum(tablefield, childfield) {
|
||||||
return this[tablefield]
|
return (this[tablefield] || [])
|
||||||
.map(d => parseFloat(d[childfield], 10) || 0)
|
.map(d => parseFloat(d[childfield], 10) || 0)
|
||||||
.reduce((a, b) => a + b, 0);
|
.reduce((a, b) => a + b, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user