Fetching code


frappe.call({
            method: 'frappe.client.get_list',
            args: {
            doctype: 'Purchase Invoice',
            fields:["name","posting_date"],
            filters: [
                     ['supplier', '=', frm.doc.supplier_name]
                ]
            },
            async:false,
        callback: function(r) {  
            do your thing here
        }
        });

Did you find this article useful?