Skip to content

[18.0][ADD] crm_project_create_from_template - #754

Open
edescalona wants to merge 1 commit into
OCA:18.0from
BinhexTeam:18.0-add-crm_project_create_from_template
Open

edescalona wants to merge 1 commit into
OCA:18.0from
BinhexTeam:18.0-add-crm_project_create_from_template

Conversation

@edescalona

Copy link
Copy Markdown

@BinhexTeam

T23827

The module extends crm_project_create by adding a project template selector to the crm.create.project wizard. When a template is selected, the created project is copied from that template, including its tasks, while keeping the CRM-specific values prepared by the base wizard such as project name, partner, company, description, and billable configuration.

If no template is selected, the standard behavior from crm_project_create is preserved.

@OCA-git-bot OCA-git-bot added series:18.0 mod:crm_project_create_from_template Module crm_project_create_from_template labels Jul 1, 2026
@edescalona edescalona changed the title [ADD] crm_project_create_from_template [18.0][ADD] crm_project_create_from_template Jul 1, 2026
@edescalona
edescalona force-pushed the 18.0-add-crm_project_create_from_template branch 2 times, most recently from f28ca6e to 930675d Compare July 6, 2026 23:32
@edescalona
edescalona marked this pull request as ready for review July 15, 2026 01:39
@edescalona
edescalona force-pushed the 18.0-add-crm_project_create_from_template branch from 930675d to 7bb7f3a Compare October 22, 2026 19:01

@rrebollo rrebollo 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.

Two points before merge.

Packaging: one field and one branch on the existing wizard; I would have expected an [IMP] to crm_project_create, not a new addon. If the reason is the hard project_template dependency an [IMP] would add, say so in the body and that settles it.
wizards/crm_create_project.py:21 — the sudo copy reads a template the salesman names, so a project he cannot see is copied into one he can. Reproduced on 18.0.
The rest matches the PR.

self.ensure_one()
if not self.project_template_id:
return super().create_project()
project = self.project_template_id.sudo().copy(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The sudo() exists so a salesman can create a project: crm.create.project is granted to group_sale_salesman, while project.project gives group_project_user read only and creation to the manager (project/security/ir.model.access.csv:2-3). Escalating the lead's create is fine; reading a template the user names is not — is_template is a UI domain and the copy carries its description and tasks. Core guards before escalating (mail/controllers/thread.py:65) or drops sudo after the copy (html_editor/controllers/main.py:399), so check read access, or make templates readable by rule.

Suggested change
project = self.project_template_id.sudo().copy(
self.project_template_id.check_access("read")
project = self.project_template_id.sudo().copy(

@edescalona
edescalona force-pushed the 18.0-add-crm_project_create_from_template branch from 7bb7f3a to 0de60b3 Compare November 4, 2026 19:10
@edescalona

Copy link
Copy Markdown
Author

Hi @rrebollo could you please review again? Thanks

@edescalona
edescalona requested a review from rrebollo November 4, 2026 19:15

@rrebollo rrebollo 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.

Code Review. LGTM!

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

Labels

mod:crm_project_create_from_template Module crm_project_create_from_template series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants