From 4984bccbc65e18b0d6bdc8e353f61c033ab9f851 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 21 May 2015 12:51:07 +0530 Subject: [PATCH] [fix] load taxes_and_charges only if field present --- erpnext/public/js/controllers/transaction.js | 26 +++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index a3f1ecae9c..7e5dc32139 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -66,18 +66,22 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ apply_default_taxes: function() { var me = this; - return frappe.call({ - method: "erpnext.controllers.accounts_controller.get_default_taxes_and_charges", - args: { - "master_doctype": frappe.meta.get_docfield(me.frm.doc.doctype, "taxes_and_charges", - me.frm.doc.name).options - }, - callback: function(r) { - if(!r.exc) { - me.frm.set_value("taxes", r.message); + var taxes_and_charges_field = frappe.meta.get_docfield(me.frm.doc.doctype, "taxes_and_charges", + me.frm.doc.name); + + if(taxes_and_charges_field) { + frappe.call({ + method: "erpnext.controllers.accounts_controller.get_default_taxes_and_charges", + args: { + "master_doctype": taxes_and_charges_field.options + }, + callback: function(r) { + if(!r.exc) { + me.frm.set_value("taxes", r.message); + } } - } - }); + }); + } }, setup_sms: function() {