[fix] [minor] show stock ledger, general ledger, fixes post changes in script manager trigger [issue] webnotes/wnframework#228
diff --git a/public/js/complete_setup.js b/public/js/complete_setup.js
index d18bc82..3a6bad5 100644
--- a/public/js/complete_setup.js
+++ b/public/js/complete_setup.js
@@ -54,7 +54,7 @@
 			$('header').toggle(false); // hide toolbar
 		}
 		
-		return wn.call({
+		wn.call({
 			method:"webnotes.country_info.get_country_timezone_info",
 			callback: function(data) {
 				erpnext.country_info = data.message.country_info;
diff --git a/public/js/controllers/stock_controller.js b/public/js/controllers/stock_controller.js
index ccbca4e..e657185 100644
--- a/public/js/controllers/stock_controller.js
+++ b/public/js/controllers/stock_controller.js
@@ -19,22 +19,26 @@
 erpnext.stock.StockController = wn.ui.form.Controller.extend({
 	show_stock_ledger: function() {
 		var me = this;
-		this.frm.add_custom_button("Stock Ledger", function() {
-			wn.route_options = {
-				voucher_no: me.frm.doc.name,
-				from_date: cur_frm.doc.posting_date,
-				to_date: cur_frm.doc.posting_date
-			};
-			wn.set_route('stock-ledger');
-		}, "icon-bar-chart");
+		if(this.frm.doc.docstatus===1) {
+			this.frm.add_custom_button("Stock Ledger", function() {
+				wn.route_options = {
+					voucher_no: me.frm.doc.name,
+					from_date: me.frm.doc.posting_date,
+					to_date: me.frm.doc.posting_date
+				};
+				wn.set_route('stock-ledger');
+			}, "icon-bar-chart");
+		}
+		
 	},
 	show_general_ledger: function() {
-		if(doc.docstatus==1) { 
+		var me = this;
+		if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_inventory_accounting"))) { 
 			cur_frm.add_custom_button('Accounting Ledger', function() {
 				wn.route_options = {
-					"voucher_no": doc.name,
-					"from_date": doc.posting_date,
-					"to_date": doc.posting_date,
+					"voucher_no": me.frm.doc.name,
+					"from_date": me.frm.doc.posting_date,
+					"to_date": me.frm.doc.posting_date,
 				};
 				wn.set_route("general-ledger");
 			});
diff --git a/public/js/transaction.js b/public/js/transaction.js
index 2062fe5..2cee843 100644
--- a/public/js/transaction.js
+++ b/public/js/transaction.js
@@ -15,8 +15,9 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 wn.provide("erpnext");
+wn.require("app/js/controllers/stock_controller.js");
 
-erpnext.TransactionController = wn.ui.form.Controller.extend({
+erpnext.TransactionController = erpnext.stock.StockController.extend({
 	onload: function() {
 		if(this.frm.doc.__islocal) {
 			var me = this,