Custom Doctype

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

DocType Detail

  1. Module: Select module in which this Doctype should be placed.
  2. Document Type: Specify if this Doctype will be to carry master data, or to track transactions. Doctype for book will be added as Master.
  3. 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.
  4. Is Single: If checked, this Doctype will become a single form, like Selling Setting, which user will not be able to re-produce.
  5. Custom?: This field will be checked by default when adding Custom Doctype.

Doctype Basic

Fields

In the Fields Table, you can add the fields (properties) of the DocType (Article).

Fields are much more than database columns, they can be:

  1. Columns in the database
  2. For Layout (section / column breaks)
  3. Child tables (Table type field)
  4. HTML
  5. Actions (button)
  6. Attachments or Images

Doc fields

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.

Naming

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.

Doctype Naming

Permission

In this table, you should select roles and define permission roles for them for this Doctype.

Doctype Permissions

Save DocType

On saving doctype, you will get pop-up to provide name for this Doctype.

Doctype Save

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

Doctype List

Book master

Using the fields entered, following is the master one book.

Doctype Form

Next: Document Title