From 8f507a984e807fbb3e3ae5ee659cfaa9512de1e2 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Thu, 13 Jul 2017 11:44:29 +0530 Subject: [PATCH] [minor] check if the company is selected or not before triggering get_bank_cash_account (#9830) * [minor] check if the company is selected or not before triggering get_bank_cash_account * [minor] check if production order is available * [minor] fixed codacy errors --- erpnext/public/js/controllers/accounts.js | 6 +++++- erpnext/stock/doctype/stock_entry/stock_entry.js | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index aefc212018..19ef162f3d 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -89,7 +89,11 @@ frappe.ui.form.on('Salary Structure', { } }) -var get_payment_mode_account = function(frm, mode_of_payment, callback){ +var get_payment_mode_account = function(frm, mode_of_payment, callback) { + if(!frm.doc.company) { + frappe.throw(__("Please select the Company first")); + } + return frappe.call({ method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account", args: { diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index c9a76aa4a2..1214346a53 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -340,10 +340,15 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ production_order: function() { var me = this; this.toggle_enable_bom(); + if(!me.frm.doc.production_order) { + return; + } return frappe.call({ method: "erpnext.stock.doctype.stock_entry.stock_entry.get_production_order_details", - args: {production_order: me.frm.doc.production_order}, + args: { + production_order: me.frm.doc.production_order + }, callback: function(r) { if (!r.exc) { $.each(["from_bom", "bom_no", "fg_completed_qty", "use_multi_level_bom"], function(i, field) {