Merge pull request #11412 from netchampfaris/fix-check-name-exists

fix: Also check if name is set, since empty object is truthy
This commit is contained in:
mergify[bot] 2020-09-04 08:05:06 +00:00 committed by GitHub
commit 63bab8166f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,7 +61,7 @@ frappe.ui.form.ControlData = frappe.ui.form.ControlInput.extend({
// check if name exists
frappe.db.get_value(this.doctype, this.$input.val(),
'name', (val) => {
if (val) {
if (val && val.name) {
this.set_description(__('{0} already exists. Select another name', [val.name]));
}
},