Show general/stock ledger button links to new query reports
diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js
index b6986cf..8837586 100644
--- a/accounts/doctype/account/account.js
+++ b/accounts/doctype/account/account.js
@@ -95,9 +95,10 @@
wn.route_options = {
"account": doc.name,
"from_date": sys_defaults.year_start_date,
- "to_date": sys_defaults.year_end_date
+ "to_date": sys_defaults.year_end_date,
+ "company": doc.company
};
- wn.set_route("general-ledger");
+ wn.set_route("query-report", "General Ledger");
}, "icon-table");
}
}
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index a5cd06d..6b94ba1 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -120,8 +120,9 @@
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
+ "company": doc.company
};
- wn.set_route("general-ledger");
+ wn.set_route("query-report", "General Ledger");
}, "icon-table");
}
}
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js
index fc530dd..0bdc70e 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -35,8 +35,9 @@
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
+ "company": doc.company
};
- wn.set_route("query-report/General Ledger");
+ wn.set_route("query-report", "General Ledger");
}, "icon-table");
}
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 55f6dde..a390fb4 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -54,8 +54,9 @@
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
+ "company": doc.company
};
- wn.set_route("query-report/General Ledger");
+ wn.set_route("query-report", "General Ledger");
}, "icon-table");
var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100);
diff --git a/accounts/page/accounts_browser/accounts_browser.js b/accounts/page/accounts_browser/accounts_browser.js
index d57073a..235e6ab 100644
--- a/accounts/page/accounts_browser/accounts_browser.js
+++ b/accounts/page/accounts_browser/accounts_browser.js
@@ -175,9 +175,10 @@
wn.route_options = {
"account": node.data('label'),
"from_date": sys_defaults.year_start_date,
- "to_date": sys_defaults.year_end_date
+ "to_date": sys_defaults.year_end_date,
+ "company": me.company
};
- wn.set_route("general-ledger");
+ wn.set_route("query-report", "General Ledger");
},
rename: function() {
var node = this.selected_node();
diff --git a/accounts/utils.py b/accounts/utils.py
index caad793..8971c80 100644
--- a/accounts/utils.py
+++ b/accounts/utils.py
@@ -16,7 +16,7 @@
def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1):
- return get_fiscal_years(date, fiscal_year, label, verbose=1)[0]
+ return get_fiscal_years(date, fiscal_year, label, verbose)[0]
def get_fiscal_years(date=None, fiscal_year=None, label="Date", verbose=1):
# if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate)
diff --git a/public/js/account_tree_grid.js b/public/js/account_tree_grid.js
index 44bef57..1cd9aa6 100644
--- a/public/js/account_tree_grid.js
+++ b/public/js/account_tree_grid.js
@@ -26,9 +26,10 @@
show: true,
parent_field: "parent_account",
formatter: function(item) {
- return repl('<a href="#general-ledger/account=%(enc_value)s">%(value)s</a>', {
+ return repl("<a \
+ onclick='wn.cur_grid_report.show_general_ledger(\"%(value)s\")'>\
+ %(value)s</a>", {
value: item.name,
- enc_value: encodeURIComponent(item.name)
});
}
},
@@ -211,4 +212,14 @@
return;
}
},
+
+ show_general_ledger: function(account) {
+ wn.route_options = {
+ account: account,
+ company: this.company,
+ from_date: this.from_date,
+ to_date: this.to_date
+ };
+ wn.set_route("query-report", "General Ledger");
+ }
});
\ No newline at end of file
diff --git a/public/js/controllers/stock_controller.js b/public/js/controllers/stock_controller.js
index ee5c497..d2fb904 100644
--- a/public/js/controllers/stock_controller.js
+++ b/public/js/controllers/stock_controller.js
@@ -11,9 +11,10 @@
wn.route_options = {
voucher_no: me.frm.doc.name,
from_date: me.frm.doc.posting_date,
- to_date: me.frm.doc.posting_date
+ to_date: me.frm.doc.posting_date,
+ company: me.frm.doc.company
};
- wn.set_route('stock-ledger');
+ wn.set_route("query-report", "Stock Ledger");
}, "icon-bar-chart");
}
@@ -24,11 +25,12 @@
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
cur_frm.appframe.add_button(wn._('Accounting 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,
+ voucher_no: me.frm.doc.name,
+ from_date: me.frm.doc.posting_date,
+ to_date: me.frm.doc.posting_date,
+ company: me.frm.doc.company
};
- wn.set_route("general-ledger");
+ wn.set_route("query-report", "General Ledger");
}, "icon-table");
}
},
diff --git a/public/js/stock_analytics.js b/public/js/stock_analytics.js
index 832cac5..8b68d39 100644
--- a/public/js/stock_analytics.js
+++ b/public/js/stock_analytics.js
@@ -17,10 +17,10 @@
parent_field: "parent_item_group",
formatter: function(item) {
if(!item.is_group) {
- return repl('<a href="#stock-ledger/item_code=%(enc_value)s">%(value)s</a>',
- {
+ return repl("<a \
+ onclick='wn.cur_grid_report.show_stock_ledger(\"%(value)s\")'>\
+ %(value)s</a>", {
value: item.name,
- enc_value: encodeURIComponent(item.name)
});
} else {
return item.name;
@@ -183,5 +183,13 @@
},
get_plot_points: function(item, col, idx) {
return [[dateutil.user_to_obj(col.name).getTime(), item[col.field]]]
+ },
+ show_stock_ledger: function(item_code) {
+ wn.route_options = {
+ item_code: item_code,
+ from_date: this.from_date,
+ to_date: this.to_date
+ };
+ wn.set_route("query-report", "Stock Ledger");
}
});
\ No newline at end of file