DocType or a Document Type is a tool to insert form in ERPNext. The forms like Sales Order, Sales Invoices, Production Order are added as Doctype in the backend. Let's assume we are creating a Custom Doctype for a Book.
Custom Doctype allows you to insert custom forms in ERPNext as per your requirement.
To create a new DocType, go to:
Setup > Customize > Doctype > New
- Module: Select module in which this Doctype should be placed.
- Document Type: Specify if this Doctype will be to carry master data, or to track transactions. Doctype for book will be added as Master.
- Is Child table: If this Doctype is to be inserted as table into another Doctype, like Item table in the Sales Order Doctype, then you should check Is Child Table. Else no.
- Is Single: If checked, this Doctype will become a single form, like Selling Setting, which user will not be able to re-produce.
- Custom?: This field will be checked by default when adding Custom Doctype.
In the Fields Table, you can add the fields (properties) of the DocType (Article).
Fields are much more than database columns, they can be:
- Columns in the database
- For Layout (section / column breaks)
- Child tables (Table type field)
- Actions (button)
- Attachments or Images
When you add fields, you need to enter the Type. Label is optional for Section Break and Column Break. Name (
fieldname) is the name of the database table column.
You can also set other properties of the field like whether it is mandatory, read only etc.
In this section, you can define criteria based on which document for this doctype will be named. There are multiple criterion based on which document can be named, like naming based on the value in the specific field, or based on Naming Series, or based on value provided by the user in the prompt, which will be shown when saving document. In the following example, we are doing naming based on the value in the field book_name.
In this table, you should select roles and define permission roles for them for this Doctype.
On saving doctype, you will get pop-up to provide name for this Doctype.
DocType in System
To check this Doctype, open Module defined for this doctype. Since we have added Books doctype in the Human Resource module, to access this doctype, go to:
Human Resource > Document > Book
Using the fields entered, following is the master one book.
Next: Document Title