View Ledger button Custom Script

by | Jan 13, 2023 | Frappe Framework | 0 comments

This script allows to add button called View Ledger on custom doctype called Expense Entry and load General Ledger according to the parameter.

frappe.ui.form.on('Expense Entry', {
    refresh(frm) {
    if(frm.doc.docstatus > 0) {
            frm.add_custom_button(__('Ledger'), function() {
                frappe.route_options = {
                    "voucher_no": frm.doc.name,
                    "from_date": frm.doc.posting_date,
                    "to_date": moment(frm.doc.modified).format('YYYY-MM-DD'),
                    "company": frm.doc.company,
                    "finance_book": frm.doc.finance_book,
                    "group_by": 'Group by Voucher (Consolidated)',
                    "show_cancelled_entries": frm.doc.docstatus === 2
                };
                frappe.set_route("query-report", "General Ledger");
            });
        }

    
    }
})

 

By Aadhil PM

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *