mirror of
https://github.com/frappe/books.git
synced 2026-08-24 10:04:45 -05:00
Merge pull request #116 from rmehta/default-as-function
This commit is contained in:
+5
-1
@@ -111,7 +111,11 @@ module.exports = class BaseDocument extends Observable {
|
||||
defaultValue = [];
|
||||
}
|
||||
if (field.default) {
|
||||
defaultValue = field.default;
|
||||
if (typeof field.default === 'function') {
|
||||
defaultValue = field.default(this);
|
||||
} else {
|
||||
defaultValue = field.default;
|
||||
}
|
||||
}
|
||||
|
||||
this[field.fieldname] = defaultValue;
|
||||
|
||||
Reference in New Issue
Block a user