2015-03-03 09:25:30 +00:00
|
|
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2013-08-05 09:29:54 +00:00
|
|
|
// License: GNU General Public License v3. See license.txt
|
2013-01-11 13:55:46 +00:00
|
|
|
|
2014-02-14 10:17:51 +00:00
|
|
|
frappe.provide("erpnext.stock");
|
2013-01-11 13:55:46 +00:00
|
|
|
|
2014-02-14 10:17:51 +00:00
|
|
|
erpnext.stock.StockController = frappe.ui.form.Controller.extend({
|
2014-06-24 13:23:04 +00:00
|
|
|
onload: function() {
|
|
|
|
// warehouse query if company
|
|
|
|
if (this.frm.fields_dict.company) {
|
|
|
|
this.setup_warehouse_query();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setup_warehouse_query: function() {
|
2015-08-13 06:17:25 +00:00
|
|
|
var me = this;
|
|
|
|
erpnext.queries.setup_queries(this.frm, "Warehouse", function() {
|
2014-06-25 07:59:43 +00:00
|
|
|
return erpnext.queries.warehouse(me.frm.doc);
|
2014-06-24 13:23:04 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2013-01-11 13:55:46 +00:00
|
|
|
show_stock_ledger: function() {
|
|
|
|
var me = this;
|
2013-07-30 09:12:15 +00:00
|
|
|
if(this.frm.doc.docstatus===1) {
|
2014-12-16 11:49:36 +00:00
|
|
|
cur_frm.add_custom_button(__("Stock Ledger"), function() {
|
2014-02-14 10:17:51 +00:00
|
|
|
frappe.route_options = {
|
2013-07-30 09:12:15 +00:00
|
|
|
voucher_no: me.frm.doc.name,
|
|
|
|
from_date: me.frm.doc.posting_date,
|
2013-12-23 11:37:57 +00:00
|
|
|
to_date: me.frm.doc.posting_date,
|
|
|
|
company: me.frm.doc.company
|
2013-07-30 09:12:15 +00:00
|
|
|
};
|
2014-02-14 10:17:51 +00:00
|
|
|
frappe.set_route("query-report", "Stock Ledger");
|
2013-07-30 09:12:15 +00:00
|
|
|
}, "icon-bar-chart");
|
|
|
|
}
|
2014-06-24 13:23:04 +00:00
|
|
|
|
2013-07-09 06:35:33 +00:00
|
|
|
},
|
2013-10-17 11:31:14 +00:00
|
|
|
|
2013-07-09 06:35:33 +00:00
|
|
|
show_general_ledger: function() {
|
2013-07-30 09:12:15 +00:00
|
|
|
var me = this;
|
2015-07-29 07:46:37 +00:00
|
|
|
if(this.frm.doc.docstatus===1) {
|
2014-12-16 11:49:36 +00:00
|
|
|
cur_frm.add_custom_button(__('Accounting Ledger'), function() {
|
2014-02-14 10:17:51 +00:00
|
|
|
frappe.route_options = {
|
2013-12-23 11:37:57 +00:00
|
|
|
voucher_no: me.frm.doc.name,
|
|
|
|
from_date: me.frm.doc.posting_date,
|
|
|
|
to_date: me.frm.doc.posting_date,
|
2014-01-03 07:00:24 +00:00
|
|
|
company: me.frm.doc.company,
|
|
|
|
group_by_voucher: false
|
2013-07-09 06:35:33 +00:00
|
|
|
};
|
2014-02-14 10:17:51 +00:00
|
|
|
frappe.set_route("query-report", "General Ledger");
|
2013-11-15 08:25:45 +00:00
|
|
|
}, "icon-table");
|
2013-07-09 06:35:33 +00:00
|
|
|
}
|
2013-01-11 13:55:46 +00:00
|
|
|
}
|
2014-06-24 13:23:04 +00:00
|
|
|
});
|