From 51c500d446ed1598e63c2702471a7ebd3960a825 Mon Sep 17 00:00:00 2001 From: Marica Date: Fri, 12 Mar 2021 15:51:45 +0530 Subject: [PATCH] fix: Don't throw exception on invoice lines when there is no item_code (fixes #24640) (#24864) Co-authored-by: casesolved-co-uk --- erpnext/public/js/controllers/transaction.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 123d998838..dce8e5d68b 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1884,7 +1884,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ frappe.throw(__("Please enter Item Code to get batch no")); } else if (doc.doctype == "Purchase Receipt" || (doc.doctype == "Purchase Invoice" && doc.update_stock)) { - return { filters: {'item': item.item_code} } @@ -1910,9 +1909,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ set_query_for_item_tax_template: function(doc, cdt, cdn) { var item = frappe.get_doc(cdt, cdn); if(!item.item_code) { - frappe.throw(__("Please enter Item Code to get item taxes")); + return doc.company ? {filters: {company: doc.company}} : {}; } else { - let filters = { 'item_code': item.item_code, 'valid_from': ["<=", doc.transaction_date || doc.bill_date || doc.posting_date], @@ -2123,4 +2121,4 @@ erpnext.apply_putaway_rule = (frm, purpose=null) => { } } }); -}; \ No newline at end of file +};