[Tutorial] How to Override Custom Button Behavior inside Standard Doctype

Hello Guys i faced this problem and there was no direct solution for it. so i did work around for it.
1 - In Doctype Custom Script form refresh evernt remove the button you want to override using

// remove custom button

// remove custom button in a group
frm.remove_custom_button('Quotation', 'Create');

2- add new custom button as it`s old name

// Custom buttons
frm.add_custom_button('Open Reference form', () => {
     // put your logic here 

// Custom buttons in groups
frm.add_custom_button('Quotation', () => {
    // put your logic here 
}, 'Create');

finally you are done ^ ^