ERPNEXT custom button to link to same doctype

Hello All,

I want to create Make button on submitted stock entry Material Transfer transaction, to create a new stock entry Material Transfer transaction having same content (mapped content) from the submitted Transaction. can anyone help me making this.

Thank you in advance for your help.

Menu > Duplicate is available by default.

Add this in Custom Script for Stock Entry (Unnecessary when Duplicate is already available)

frappe.ui.form.on('Stock Entry', {
	refresh: function(frm) {
		if(frm.doc.purpose == "Material Transfer" && frm.doc.docstatus == 1){		
			frm.add_custom_button(__('Make'), function () {

Thank you very much revant_one,
now it is clear.
can any one help me where to find the code for frm.copy_doc() function.