From eade5770b03ecb60d2bfc3ea1e9f2e6eccca994e Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Fri, 25 Feb 2022 15:22:28 +0530 Subject: [PATCH] fix: don't set empty values --- src/dataImport.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dataImport.ts b/src/dataImport.ts index 197667e14..c10505308 100644 --- a/src/dataImport.ts +++ b/src/dataImport.ts @@ -350,7 +350,6 @@ export class Importer { } } - // return docObjs; return Object.keys(docMap).map((k) => docMap[k]); } @@ -363,8 +362,15 @@ export class Importer { delete docObj.name; } - const doc = frappe.getNewDoc(this.doctype); + for (const key in docObj) { + if (docObj[key] !== '') { + continue; + } + delete docObj[key]; + } + + const doc = frappe.getNewDoc(this.doctype); try { await doc.set(docObj); await doc.insert();