Custom filter not working in Payment Entry

refresh(frm) {

    frm.add_custom_button('Pay Advance', function() {
        frappe.new_doc('Payment Entry', {
            'payment_type': 'Internal Transfer',
        });
        
        frm.set_query('paid_from', function() {
                return {
                    'filters': {
                       'doctype':'Accounts Receivable'
                                  
                    }
                };
        });
    });
      
}

By using this code i want to set a filter on ‘paid_from’ field in the ‘Payment Entry’ doc.What i am doing here is , i have a custom button ‘Pay Advance’ if i click that i will enter in a new ‘Payment Entry’ also set values on some field ,at the same time i want to set a new filter on the existing field ‘paid_from’ , which already have another filter working , but i want to override and set my new filter ,the values from ‘Accounts Receivable’ . ‘Accounts Receivable’ is inside Chart of Accounts.How can i do that ?

HI @Sikil_P_M

Try this code I hope it works

frappe.ui.form.on('Payment Entry', {
	refresh(frm) {
		frm.set_query("paid_from", function() {
			return {
				filters: {
					"name":"Accounts Receivable"
				}
			}
		});
	}
})

Thank You!

1 Like

thanks

@Sikil_P_M If you find my code correct then you can give a solution mark to my post
Thank You!