Customize form vs modifying doctype

What is the difference between adding a custom field through “setup/customize form” or modifying the doctype directly?
Are they the same results?

2 Likes

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 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

2 Likes

Well I’m also confused here. You can create a new doctype (Form) directly in ERPNext. Also add custom javascript. I don’t understand when to move it to custom app and when to just create new Forms inside ERPNext.
Is there any documentation describing the use case when to do what? It seems there are so many options how to do customisation and it creates a lot of confusion for people like me - who are not experienced developers, but who can do a little customisations.

@Fernando_Sanchez1 When you customise a form, the changes will get reflected in the database, whereas the changes made in the DocType would be reflected in the .json file as well. So, when you will try to update bench / pull from erpnext / frappe, it will generate errors. You can customise a form, if you want those changes specifically for yourself, and if you think those changes are required or may act as an enhancement/ feature for everyone, you can edit it into the DocType and get it merged to avoid any conflicts while updating the apps.

"
Well I’m also confused here. You can create a new doctype (Form) directly in ERPNext. Also add custom javascript. I don’t understand when to move it to custom app and when to just create new Forms inside
"
@bedo 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
Not Found

https://erpnext.org/docs/user/manual/en/customize-erpnext/customize-form
Customize Form

edit: Be sure to refer also to Frappe VP product nabinhait’s notes for example Difference between doc type and form - #2 by nabinhait

So I’ve jumped into ERPNext and Frappe a little too fast without reading all the documentations. I didn’t realize “Customize form” is the correct way to modify ERPNext.

I’ve already done some customizations with Customize doctype. Is there a good practice to switch all those changes using Customize form so the .json file’s remain correct?

Hi @dj12djdjs
Even I am in similar situation. Can you explain how you handled this if you have arrived on a solution. Or anybody else for that matter.
Since I wasn’t aware of the fact i too ended up editing the DocType
Thanks in advance :slight_smile:

@ImranK I’m sure there is a better way of doing it. I just went through all the doctypes I modified wrote down the modification. After I took note of all the modifications I made I overrode my local changes with frappe/erpnext:version-13 ran bench migrate. Then I added all my customizations through the Customize Form. It was a very boring job but It ended up working in the end.

Ohh, must have been a long day for you.
It was my last option. I guess i have no escape.
Thanks for the revert :relaxed: