How to add Button link in Document Form View ? – Frappe Framework

by | Jun 2, 2021 | Frappe Framework | 0 comments

The following steps allow placing a direct link to a specific print format on the document form view using the button.

Step 1: Open the Current print preview page and click on pdf option and copy the URL

 

Step 2

frappe.ui.form.on("Doctype Name", "refresh", function(frm){
    frm.add_custom_button("PDF", function(){
            var myWin = window.open('https://example.com/api/method/frappe.utils.print_format.download_pdf?doctype=Invoice&name='+cur_frm.doc.name+'&format=invoice%20print%20format&no_letterhead=0&letterhead=oais&settings=%7B%7D&_lang=en');
    });
});

Replace your copied URL and‘+cur_frm.doc.name+’ after Invoice&name and place it in Custom script form.

Note: Replace Doctype Name with actual Doctype and example.com to your domain

Open client script form as shown below

 

Final output: A direct button is added into the document form view as shown below:

 

By Aadhil PM

0 Comments

0 Comments

Submit a Comment

Your email address will not be published.