diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js index bafa42983da..245ff74d58f 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js @@ -20,7 +20,10 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({ "company": this.frm.doc.company }, callback: function(r) { - if (!r.exc) me.frm.set_value("expense_account", r.message); + if (!r.exc) { + me.frm.set_value("expense_account", r.message); + me.frm.script_manager.trigger("refresh"); + } } }); } diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index fe65f226701..35030a6a783 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -294,9 +294,8 @@ class StockReconciliation(StockController): if not self.expense_account: msgprint(_("Please enter Expense Account"), raise_exception=1) elif not frappe.db.sql("""select * from `tabStock Ledger Entry`"""): - if frappe.db.get_value("Account", self.expense_account, - "report_type") == "Profit and Loss": - frappe.throw(_("'Profit and Loss' type Account {0} used be set for Opening Entry").format(self.expense_account)) + if frappe.db.get_value("Account", self.expense_account, "report_type") == "Profit and Loss": + frappe.throw(_("Difference Account must be a 'Liability' type account, since this Stock Reconciliation is an Opening Entry")) @frappe.whitelist() def upload():