From d95b59e90c4d1b0a58a8e2ddb0f2ae908070a6bd Mon Sep 17 00:00:00 2001 From: Afshan Date: Mon, 8 Mar 2021 18:19:53 +0530 Subject: [PATCH] fix: call function when arguments available --- .../public/js/controllers/taxes_and_totals.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index d81321b291..3a3ee3858b 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -158,16 +158,18 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ let me = this; frappe.flags.round_off_applicable_accounts = []; - return frappe.call({ - "method": "erpnext.controllers.taxes_and_totals.get_round_off_applicable_accounts", - "args": { - "company": me.frm.doc.company, - "account_list": frappe.flags.round_off_applicable_accounts - }, - callback: function(r) { - frappe.flags.round_off_applicable_accounts.push(...r.message); - } - }); + if (me.frm.doc.company) { + return frappe.call({ + "method": "erpnext.controllers.taxes_and_totals.get_round_off_applicable_accounts", + "args": { + "company": me.frm.doc.company, + "account_list": frappe.flags.round_off_applicable_accounts + }, + callback: function(r) { + frappe.flags.round_off_applicable_accounts.push(...r.message); + } + }); + } }, determine_exclusive_rate: function() {