Customizing the Create dropdown

Hi,

is it possible to extend the default functionality of the “Create” dropdown to create a document of a different doctype? This is the dropdown I specifically want to extend (in Communication):

In this case, I would like to create a purchase invoice from a communication, with the same file attached (or, in the case of an electronic invoice, even completely pre-filled).

Is this a viable option or am I better off using Document Actions, which seems to be more standardized?

Thank you in advance!

Hi @AVANT-ICONIC:

Is doable with a client script for communication doctype. Something like this:

frappe.ui.form.on('Communication', {
	refresh(frm) {
    	frm.add_custom_button("Purchase Invoice", function() {
            frappe.new_doc(
                "Purchase Invoice", 
                    {
                         supplier: "YOUR SUPPLIER", 
                         bill_no: "INVOICE NUMBER" // anything else ...
                     }
             )
        }, "Create")
	}
})

Other approach would be creating some backend logic and calling it from client side.

Hope this helps.

1 Like