2013-08-05 14:59:54 +05:30
|
|
|
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
|
|
|
// License: GNU General Public License v3. See license.txt
|
2013-01-11 19:25:46 +05:30
|
|
|
|
|
|
|
wn.provide("erpnext.stock");
|
|
|
|
|
2013-03-11 19:44:52 +05:30
|
|
|
erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
2013-01-11 19:25:46 +05:30
|
|
|
show_stock_ledger: function() {
|
|
|
|
var me = this;
|
2013-07-30 14:42:15 +05:30
|
|
|
if(this.frm.doc.docstatus===1) {
|
2013-11-13 16:55:38 +05:30
|
|
|
this.frm.appframe.add_button(wn._("Stock Ledger"), function() {
|
2013-07-30 14:42:15 +05:30
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2013-07-09 12:05:33 +05:30
|
|
|
},
|
2013-10-17 17:01:14 +05:30
|
|
|
|
2013-07-09 12:05:33 +05:30
|
|
|
show_general_ledger: function() {
|
2013-07-30 14:42:15 +05:30
|
|
|
var me = this;
|
2013-08-28 19:24:52 +05:30
|
|
|
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
|
2013-11-13 16:55:38 +05:30
|
|
|
cur_frm.appframe.add_button(wn._('Accounting Ledger'), function() {
|
2013-07-09 12:05:33 +05:30
|
|
|
wn.route_options = {
|
2013-07-30 14:42:15 +05:30
|
|
|
"voucher_no": me.frm.doc.name,
|
|
|
|
"from_date": me.frm.doc.posting_date,
|
|
|
|
"to_date": me.frm.doc.posting_date,
|
2013-07-09 12:05:33 +05:30
|
|
|
};
|
|
|
|
wn.set_route("general-ledger");
|
2013-11-15 13:55:45 +05:30
|
|
|
}, "icon-table");
|
2013-07-09 12:05:33 +05:30
|
|
|
}
|
2013-10-17 17:01:14 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
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 19:25:46 +05:30
|
|
|
}
|
|
|
|
});
|