Clear field in dialog

Hi

How can I clear the "from date " and “to date” in the “Filters dialog” box which is presented to the user, when the “Get Outstanding Invoices” button is selected in the Payment Entry doctype?

If I look at the code, a frappe.prompt object is generated. Surely there must be a way to find this object and manipulate fields within that object ?

Update…

I have tried this code and when the dialog box is generated, I get the “Table” prompt.
But I am uncertain of how to access the fields on the frappe.prompt - dialog box.

frappe.ui.form.on('Payment Entry', {
    get_outstanding_invoices: function(frm) {
        frappe.show_alert("Table");
        debugger;


    }
});

Try to add your button and execute the same JS when clicked. Then tweak the code for the date part and hide the original button.

PS: You will need dates one way or another.

Thank you for your message @TurkerTunali . Apologies for the delay.

That’s what I ended up doing, eventually. I had a look at the backend code and found
the functions that was called by the “primary_action”. Then I simply hooked that up
to my own button and hid the existing buttons. And it seems to be working just fine.

However, I am constantly looking to learn other tricks / methods for customizing ERPNext, and this is one thing I would like to tick off … manipulating fields in an existing dialog-box.

Thank you for your time

1 Like