mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
fix: validateFields before insert
This commit is contained in:
parent
e609aea4b6
commit
879b57f698
@ -184,6 +184,7 @@ module.exports = class BaseDocument extends Observable {
|
||||
|
||||
validateInsert() {
|
||||
this.validateMandatory();
|
||||
this.validateFields();
|
||||
}
|
||||
|
||||
validateMandatory() {
|
||||
@ -228,6 +229,13 @@ module.exports = class BaseDocument extends Observable {
|
||||
}
|
||||
}
|
||||
|
||||
async validateFields() {
|
||||
let fields = this.meta.getValidFields();
|
||||
for (let field of fields) {
|
||||
await this.validateField(field.fieldname, this.get(field.fieldname));
|
||||
}
|
||||
}
|
||||
|
||||
async validateField(key, value) {
|
||||
let field = this.meta.getField(key);
|
||||
if (!field) {
|
||||
|
Loading…
Reference in New Issue
Block a user