Skip to content

[18.0][IMP] project_task_description_template: project templates and portal support - #1848

Open
ThiagoMForgeFlow wants to merge 3 commits into
OCA:18.0from
ForgeFlow:18.0-imp-project_task_description_template
Open

ThiagoMForgeFlow wants to merge 3 commits into
OCA:18.0from
ForgeFlow:18.0-imp-project_task_description_template

Conversation

@ThiagoMForgeFlow

@ThiagoMForgeFlow ThiagoMForgeFlow commented Oct 22, 2026 •

Copy link
Copy Markdown

Context

We use this module to give customers a predefined structure when they report tasks from the portal. To make that possible, templates need to be configurable per project, usable from the project sharing views, and enforceable for portal users.

Changes

The PR is split in three commits that can be reviewed independently:

1. Store the template on tasks

description_template_id was declared with store=False since the module was created, so the selected template was lost after saving the task and the field always appeared empty when reopening it. There is no documented reason for this in the history of the module (the 14.0 version of a module with the same purpose, #1192, stored it).

Storing it keeps track of the template used to create each task and is required to validate it server side (see commit 3). The onchange behaviour is unchanged: selecting a template still appends its content to the description.

2. Restrict templates by project

  • New project_ids field on templates, editable from both sides (template form and a new "Task Description Templates" block in the project settings).
  • The template selector on tasks only proposes the templates of the task project plus the templates without projects, which remain available everywhere as before.

3. Portal support

  • The template selector is available in the project sharing form and in the kanban quick create form.
  • Portal users can read only the templates linked to projects they collaborate on (new access right + record rule, same approach as project.milestone). Templates without projects are not visible to portal users.
  • New project option "Require Description Template on Portal Tasks". When enabled:
    • Portal users must select a template when creating a task (required in the views and validated on create). Sub-tasks are not affected.
    • Existing tasks without a template can still be edited.
    • The project must have at least one template, so it cannot be left in a state where portal users are unable to create tasks.
  • Server side, a portal user can only use templates linked to the task project.

Functional overview

1. Configuration

Templates can be linked to projects from the template or from the new "Task Description Templates" block in the project settings. On portal projects, the "Require Description Template on Portal Tasks" option forces portal users to select a template when they create a task.

Screenshots 01_project_settings 02_template_list

2. Internal users

On a task, internal users can select the templates of the task project and the templates without projects (global templates).

3. Portal users

Portal users can only see and use the templates of the projects they collaborate on. Global templates are not available to them.

Screenshot 05_portal_quick_create

When the project requires a template, the task cannot be created without one, both from the kanban quick create and from the form:

Screenshot 06_portal_quick_create_required

Selecting a template fills the task description with its content:

Screenshot 08_portal_form_template_applied

4. Template stored on the task

The selected template is now kept on the task after saving it:

Screenshot 04_backend_task_saved_template

@OCA-git-bot OCA-git-bot added series:18.0 mod:project_task_description_template Module project_task_description_template labels Oct 22, 2026
@ThiagoMForgeFlow

Copy link
Copy Markdown
Author

CI depends on #1849 : project_key blocks task creation for portal users

@ThiagoMForgeFlow

Copy link
Copy Markdown
Author

Hi @pedrobaeza @rousseldenis @alan196, could you please review this PR? It extends the module with per-project templates and portal support (see the description for the design decisions, especially the change to a stored template field).

@pedrobaeza

Copy link
Copy Markdown
Member

You should check CI first.

@ThiagoMForgeFlow

Copy link
Copy Markdown
Author

You should check CI first.

As mentioned above, the CI is failing due to an error in the project_key module. The PR that fixes this issue is #1849

The template field was not stored since the module was created, so the
template used on a task was lost after saving it.
@ThiagoMForgeFlow
ThiagoMForgeFlow force-pushed the 18.0-imp-project_task_description_template branch from b923717 to cadb83f Compare October 28, 2026 12:17
Templates can be linked to projects, so each project only proposes its own
templates and the ones without projects.
@ThiagoMForgeFlow
ThiagoMForgeFlow force-pushed the 18.0-imp-project_task_description_template branch from cadb83f to ce927b0 Compare October 28, 2026 12:47
@ThiagoMForgeFlow

Copy link
Copy Markdown
Author

Hi @pedrobaeza the CI passes now

@alan196 alan196 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

<field name="description" invisible="1" />
<field
name="description_template_id"
invisible="not portal_description_template_required"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On projects with templates that don't require one, portal users can only pick a template from the full form. Showing the field whenever the project has templates would be more consistent; it would need a small computed boolean.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! The change has been applied. The system now checks that the project has templates configured for the portal.

Portal users can select the templates of their projects in the project sharing
views, and a project can require them to select one on every new task.
@ThiagoMForgeFlow
ThiagoMForgeFlow force-pushed the 18.0-imp-project_task_description_template branch from ce927b0 to fec6690 Compare November 4, 2026 14:55

@LoisRForgeFlow LoisRForgeFlow left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants