Most Powerful Open Source ERP

How To Create New Template

How To showing how to create templates and enable them for a specific portal type.
  • Last Update:2019-01-17
  • Version:002
  • Language:en

Templates are documents with predefined structure or content. Whenever documents with similar information have to be created, templates can be useful, for example task templates within a project, namecard templates for a company or press release layout templates for documents to be published.

Table of Contents

Enabling Templates on a Portal Type

Note that in well configured ERP5 instance this is usally already done.

Templates belong to the same Portal Type as the documents they help create. To enable templates on a module like tasks, it is necessary to add this portal_type (Task) in Preferences.

Go to [your-instance-url]/portal_types/Preference and add the respective portal_type (for example Tasks) to both Allowed and Hidden content types or check if they are already in the lists.


ERP5 HowTo | Create Templates - Screenshot Preferences

Creating A Template

Creating a template now is trivial. Create a new document (task, web page, etc.) and make sure to add a title properly formatted without the leading Add. Add document contents and when done, select Make a Template from the action menu. This will store the document as a template and make it available through the module's action list.


ERP5 HowTo | Create Templates - Screenshot Make a Template

What happens under the hood?

The template is created via Base_makeTemplateFromDocument (erp5_core), which creates the template under your portal preferences. It stores a copy of your document there, so no matter what you do with the original document (rename, edit, archive, cancel), it will not change the document stored as template. To access this document, you need to go through [your-instance-url]/portal_preferences/[your_preferences] and click the templates tab. Your templates will be there in case needed. If you want to edit a template, open the existing one, make your changes re-create the template by selecting the "Make Template" action.

Creating templates for a group of users

Although not integrated, this is possible. After creating a group preferences, Manager can make a template and manually move the template from his own user preference to this group preference using cut and paste from ZMI. Make sure the security definition is configured so that all users of that group have View permission on the template.

Related Articles