mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
Merge pull request #116 from rmehta/default-as-function
This commit is contained in:
commit
3978e79863
@ -111,8 +111,12 @@ module.exports = class BaseDocument extends Observable {
|
||||
defaultValue = [];
|
||||
}
|
||||
if (field.default) {
|
||||
if (typeof field.default === 'function') {
|
||||
defaultValue = field.default(this);
|
||||
} else {
|
||||
defaultValue = field.default;
|
||||
}
|
||||
}
|
||||
|
||||
this[field.fieldname] = defaultValue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user