diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js index 4b67c0a4b6..13e7e5b479 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js @@ -36,20 +36,21 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({ set_default_expense_account: function() { var me = this; - - if (sys_defaults.auto_accounting_for_stock && !this.frm.doc.expense_account) { - return this.frm.call({ - method: "erpnext.accounts.utils.get_company_default", - args: { - "fieldname": "stock_adjustment_account", - "company": this.frm.doc.company - }, - callback: function(r) { - if (!r.exc) { - me.frm.set_value("expense_account", r.message); + if(this.frm.doc.company) { + if (sys_defaults.auto_accounting_for_stock && !this.frm.doc.expense_account) { + return this.frm.call({ + method: "erpnext.accounts.utils.get_company_default", + args: { + "fieldname": "stock_adjustment_account", + "company": this.frm.doc.company + }, + callback: function(r) { + if (!r.exc) { + me.frm.set_value("expense_account", r.message); + } } - } - }); + }); + } } },