Creating new document, adding custom button, controller, open_mapped_doc and frappe.new_doc

Hello;

As it is possible to create new document using frappe.new_doc, and as it is possible that this new document can be created by clicking on the custom button, so why we use frappe.model.open_mapped_doc as it is written in sales_order.js when it was required to create Invoice using the custom button, but we used frappe.call to call whitelist method which will use frappe.new_doc to create Payment Entry in fees in school module?

One more question which is related to the custom button:

Why in sales_order.js we used:

erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend

And in fees.js we used:

frappe.ui.form.on(“Fees”,

To create the custom button?

What I need to say, when to use controller and open_mapped_doc with adding custom button and when we do not use it?
Regards
Bilal

bro Im looking for same is there any to help its really appreciated