Adding customization in separated java script file

Hey,

A. There are mainly two ways of adding fields in doctype

  1. By Doctype list
  2. By Customization form

From end users point, it looks nothing different in functionality… But actually its different in terms of how you manage frappe/erpnext in long term.
Its highly recommend to always use Customize form to add custom fields… Its database site specific and you can update frappe and erpnext smoothly.
The reason is… editing doctype directly will affect its repo files e.g. Json files etc… And it can cause conflicts when you update frappe and erpnext.
Unless you want to add custom doctype for custom cases … For this you have to maintain it under custom app to avoid hassles in long term maintenance

Apart from this you can create new doctype same as sales invoice and use it
A good read of the docs and tutorial will clarify all this for you, for example
https://erpnext.org/docs/user/manual/en/customize-erpnext/custom-doctype
https://erpnext.org/docs/user/manual/en/customize-erpnext/customize-form

B. For dashboard, you can refer this

And for linking in dashboard