From b7f68782227aac14c2f1796f7c85c5e61ec72d80 Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 28 Apr 2020 19:18:45 +0530 Subject: [PATCH] fix: Handle empty child table --- erpnext/public/js/controllers/transaction.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index c3411496a5..bbc2d6989a 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1897,8 +1897,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ }, autofill_warehouse : function (child_table, warehouse_field, warehouse) { - let doctype = child_table[0].doctype; - if (warehouse) { + if (warehouse && child_table && child_table.length) { + let doctype = child_table[0].doctype; $.each(child_table || [], function(i, item) { frappe.model.set_value(doctype, item.name, warehouse_field, warehouse); });