Document Templates - feat: document templates by Priyal208 · Pull Request #38044 · frappe/frappe · GitHub
Document Templates let you save a pre-filled document as a reusable starting point, so that the next time you create a new record of the same DocType, you can apply the template and have the form auto-populated with all the values you saved.
This is useful for recurring entries you create often with the same (or mostly the same) data — for example, a Purchase Order for your top supplier, an RFQ for your bestselling item, or a Journal Entry you post every month.
Document Templates work on any non-single DocType.
Creating a Template
You can create a template directly from the form view, after filling in the values you want to save.
- Go to any DocType and click + Add New to open a new form.
- Fill in the fields you want stored in the template. You can fill in as many or as few fields as you like — empty fields will simply not be set when the template is applied.
- From the form’s menu, click the Templates button.
- In the dialog that appears:
- Enter a Name for the template (e.g. Monthly Rent Entry, Top Supplier PO).
- Choose the visibility:
- Private — only you can see and use this template.
- Public — anyone with access to the DocType can use this template.
- Click Save.
Alternatively, you can create a template from any already-saved document. Open the document, click the three-dot sub-menu on the document page, click Templates, and follow the same steps as above.
The template is now saved and will appear in the Templates list on every new form of that DocType.
Applying a Template
- Open a new form for the DocType where you saved the template.
- Click the Templates button.
- Select the template you want to apply from the list.
The form will be auto-populated with the fields stored in the template. You can then edit any field as needed before saving the document.
Applying a template only fills in the fields stored in it. Any fields not included in the template stay blank or keep their default values, so you can layer a template on top of an empty form without overwriting unrelated work.
Managing Templates
You can update, edit, or delete existing templates from the same Templates button.
- On any new form for the DocType, click the Templates button.
- In the dialog, you’ll see a list of all templates available to you for the current DocType — both your private ones and any public ones.
- From here you can:
- Update a template.
- Edit a template by modifying the underlying document (for example, changing visibility between Public and Private).
- Delete a template you no longer need.
You can only edit or delete templates that you created. Public templates created by other users will appear in the list but cannot be modified by you.
Private vs Public Templates
| Private | Public | |
|---|---|---|
| Visible to | Only the user and System Manager who created it | All users with access to the DocType |
| Editable by | Creator and System Manager only | Creator, System Manager, and any custom role with write permission for Document Templates |
| Use case | Personal shortcuts, drafts, frequently used data | Standard templates the whole team should use |
If you’re not sure which to pick, start with Private. You can change a template’s visibility later by editing it.
Disabled Templates
You may disable templates that you don’t use regularly and don’t want appearing in your list, but still want to preserve for future use instead of deleting them.
- Only owner, system manager or any custom role with write permission can disable a template.
- You can still see your own disabled templates at the bottom of the list, but other users won’t see them — even if the template is Public.
- Disabled templates cannot be applied. Re-enable a template if you want to apply it again.
Tips
- Default values aren’t saved. Document templates do not include fields that hold their default value and weren’t explicitly modified by the user. This means things like auto-generated reference numbers, dates, or external IDs stay out of the template and are filled in fresh each time.
- Use descriptive names. When you have several templates for the same DocType, names like PO - Acme Corp - Monthly are much easier to scan than Template 1.
- Templates are per-DocType. A template saved on Sales Invoice won’t show up on Purchase Invoice, even if the fields overlap.