Added 'Ledger' button to show accounting entries against PCV
This commit is contained in:
parent
d261d40c7e
commit
ae65172dca
@ -1,21 +1,37 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
frappe.ui.form.on('Period Closing Voucher', {
|
||||||
|
onload: function(frm) {
|
||||||
|
if (!frm.doc.transaction_date) frm.doc.transaction_date = dateutil.obj_to_str(new Date());
|
||||||
|
},
|
||||||
|
|
||||||
//========================== On Load =================================================
|
setup: function(frm) {
|
||||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
frm.set_query("closing_account_head", function() {
|
||||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
return {
|
||||||
}
|
filters: [
|
||||||
|
['Account', 'company', '=', frm.doc.company],
|
||||||
|
['Account', 'is_group', '=', '0'],
|
||||||
|
['Account', 'freeze_account', '=', 'No'],
|
||||||
|
['Account', 'root_type', 'in', 'Liability, Equity']
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
refresh: function(frm) {
|
||||||
// ***************** Get Account Head *****************
|
if(frm.doc.docstatus==1) {
|
||||||
cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) {
|
frm.add_custom_button(__('Ledger'), function() {
|
||||||
return {
|
frappe.route_options = {
|
||||||
filters: [
|
"voucher_no": frm.doc.name,
|
||||||
['Account', 'company', '=', doc.company],
|
"from_date": frm.doc.posting_date,
|
||||||
['Account', 'is_group', '=', '0'],
|
"to_date": frm.doc.posting_date,
|
||||||
['Account', 'freeze_account', '=', 'No'],
|
"company": frm.doc.company,
|
||||||
['Account', 'root_type', 'in', 'Liability, Equity']
|
group_by_voucher: 0
|
||||||
]
|
};
|
||||||
|
frappe.set_route("query-report", "General Ledger");
|
||||||
|
}, "icon-table");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user