Table Of Contents

Previous topic

11. Testing openPLM

Next topic

7. Specifications

This Page


Previous versions


12. Document templates

New in version 2.1.

12.1. Concept

OpenPLM 2.1 introduces a new feature: document templates.

Templates are suggested at document creation. If a template is selected, its files are copied when the document is created.

Templates are documents. That means they have a lifecycle and they are managed like other documents. They can be revised or deprecated. In fact, templates are just documents with a special lifecycle.

Only official templates are suggested when a document is created.

12.1.1. Differences with cloning

It was already possible to duplicate a document by using the clone feature. But when a document is cloned, its attributes are copied. If a template is cloned, the copied name and group would certainly be inaccurate.

Moreover, the template implies a different workflow. A user starts by creating a document and it directly sees that it can use a template.

12.2. Forms

get_creation_form() adds a template field to a creation form if:

  • the type is a Document type which accepts file

This field is hidden if (one of the conditions):

  • the creation follows an upload (pfiles parameter set)
  • no official templates of the given type exit
  • the template argument is set to False

This is a ModelChoiceField which accepts a null value.

12.3. Database implementation

12.3.1. Document model

The Document model has a new foreign key, template which identifies the template used at creation time. This field can be null (the default).

12.3.2. Lifecycle

A new type of lifecycle, Lifecycle.TEMPLATE is available (database value: 4).

These lifecycles must have, at least, a draft, an official and a deprecated states