2013-11-20 07:29:58 +00:00
|
|
|
// Copyright (c) 2013, Web Notes 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
|
|
|
|
|
|
|
wn.provide("erpnext.stock");
|
|
|
|
|
2013-03-11 14:14:52 +00:00
|
|
|
erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
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) {
|
2013-11-13 11:25:38 +00:00
|
|
|
this.frm.appframe.add_button(wn._("Stock Ledger"), function() {
|
2013-07-30 09:12:15 +00:00
|
|
|
wn.route_options = {
|
|
|
|
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
|
|
|
};
|
2013-12-23 11:37:57 +00:00
|
|
|
wn.set_route("query-report", "Stock Ledger");
|
2013-07-30 09:12:15 +00:00
|
|
|
}, "icon-bar-chart");
|
|
|
|
}
|
|
|
|
|
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;
|
2013-08-28 13:54:52 +00:00
|
|
|
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
|
2013-11-13 11:25:38 +00:00
|
|
|
cur_frm.appframe.add_button(wn._('Accounting Ledger'), function() {
|
2013-07-09 06:35:33 +00:00
|
|
|
wn.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,
|
|
|
|
company: me.frm.doc.company
|
2013-07-09 06:35:33 +00:00
|
|
|
};
|
2013-12-23 11:37:57 +00:00
|
|
|
wn.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-10-17 11:31:14 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
copy_account_in_all_row: function(doc, dt, dn, fieldname) {
|
|
|
|
var d = locals[dt][dn];
|
|
|
|
if(d[fieldname]){
|
|
|
|
var cl = getchildren(this.frm.cscript.tname, doc.name, this.frm.cscript.fname, doc.doctype);
|
|
|
|
for(var i = 0; i < cl.length; i++) {
|
|
|
|
if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
refresh_field(this.frm.cscript.fname);
|
2013-01-11 13:55:46 +00:00
|
|
|
}
|
|
|
|
});
|