A doubt about the design of Doctypes

I have a question, what is the relationship between a Doctype and its JSON file?

I have created a custom Doctype and, to define its design, I used a JSON file, but when I access said Doctype, I get errors like Invalid Control Name in the layout.

I thought that the problem could be that the system not only uses the JSON file, but also uses the Doctype entry in Setup > Customize > Doctype to define the layout.

Could someone guide me a little on this topic?

This JSON file is an exported format of the Database table that corresponds to your Doctype.

You don’t have to manually create any JSON files. System will create them.

If your doctype has Is Custom checked on creation then no JSON file will be made. It will stay just in the Database.

Now the important things:

  • If you want to change something (add/rearrange/change property of field) in a default ERPNext doctype, ALWAYS use only Customize Form or the Customize Option.
  • If you wish to create a new document, create it with Edit Doctype but keep those changes in a seperate app.

Also if you do changes via Customize Form and don’t wish to lose them: then follow advice as mentioned here:

2 Likes

Thank you very much for the information @root13F.

The problem is that I do not know the Git commands to manage different versions of ERPNext.

Do you mean that these JSON files are present in the ERPNext directory from the terminal?

I can not uncheck that option when creating a custom Doctype.

Don’t worry you can take a git tutorial. It is simple and you can learn.

As far as ERPNext/Frappe is concerned I will tell you a few basics that you should know:

Branch is a version of the application. Now you must be hearing master branch or develop branch or staging etc. etc.

  1. master - the stable version of the app. This is is the branch your production server should be running on.

  2. develop - the experimental version of the app containing features that may feature in upcoming versions.


They are automatically created when you create a doctype or report from the UI. The devs have taken care of that already.


It means your site is not in developer_mode but on production_mode

To set it right execute this command:

bench --site your_current_site set-config developer_mode 1

To know what is your current site is:

  1. Open frappe-bench folder, go to sites folder
  2. There will be a textfile - currentsite.txt
  3. The name mentioned in that text file is the current site name
1 Like

Thank you very much for your help @root13F.
I am currently taking several Git tutorials and getting used to its different branches.
I needed this kind of information to understand Git and understand how to develop a little better ERPNext

1 Like

All the best !