2
0
mirror of https://github.com/frappe/books.git synced 2024-12-25 20:11:15 +00:00

fix: validate field only if value is set

This commit is contained in:
Faris Ansari 2020-01-01 13:39:31 +05:30
parent 53b0eea4f2
commit ce5ecd1c18

View File

@ -244,7 +244,7 @@ module.exports = class BaseDocument extends Observable {
if (field.fieldtype == 'Select') { if (field.fieldtype == 'Select') {
this.meta.validateSelect(field, value); this.meta.validateSelect(field, value);
} }
if (field.validate) { if (field.validate && value != null) {
let validator = null; let validator = null;
if (typeof field.validate === 'object') { if (typeof field.validate === 'object') {
validator = this.getValidateFunction(field.validate); validator = this.getValidateFunction(field.validate);