mirror of
https://github.com/frappe/books.git
synced 2026-08-24 02:24:17 -05:00
fix: Handle null table
This commit is contained in:
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user