I want to add the custom button on sales invoice through another app

I Want to add the custom button to the sales invoice through another app if I install the app that button should appear if I uninstall it the button should disappear
How Can I achieve It

@Mohammed_Anas1 write your js code inside your app folder for example public/js/sales_invoice.js (same normal code) . then open hooks.py and add doctype_js = {"Sales Invoice" : "public/js/sales_invoice.js"}