Skip to content

[17.0][FIX] project_task_default_stage: Do not set user_id on default stages#1446

Merged
OCA-git-bot merged 1 commit intoOCA:17.0from
Tecnativa:17.0-fix-project_task_default_stage
Mar 13, 2025
Merged

[17.0][FIX] project_task_default_stage: Do not set user_id on default stages#1446
OCA-git-bot merged 1 commit intoOCA:17.0from
Tecnativa:17.0-fix-project_task_default_stage

Conversation

@carlos-lopez-tecnativa
Copy link
Copy Markdown
Contributor

Odoo has a global record rule that filters records based on user_id. Since this field has a default value of self.env.uid, these records become owned by the Odoo bot. If you try to access a record using self.env.ref("project_task_default_stage.project_tt_specification").name, an error occurs.

https://github.com/odoo/odoo/blob/8a2eae27f46247a218facd3b8e27a67161934c8b/addons/project/security/project_security.xml#L122-L126

image

Behavior before the fix: New projects were created without default stages
image

Behavior after the fix: New projects are now created with default stages
image

@pedrobaeza could you please review this

Odoo has a global record rule that filters records based on user_id. Since this field has a default value of self.env.uid, these records become owned by the Odoo bot. If you try to access a record using self.env.ref("project_task_default_stage.project_tt_specification"), an error occurs.

https://github.com/odoo/odoo/blob/8a2eae27f46247a218facd3b8e27a67161934c8b/addons/project/security/project_security.xml#L122-L126
@pedrobaeza pedrobaeza added this to the 17.0 milestone Mar 13, 2025
Copy link
Copy Markdown
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. Fast-tracking for solving the problem

/ocabot merge nobump

@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 17.0-ocabot-merge-pr-1446-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 254ff25 into OCA:17.0 Mar 13, 2025
7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 4862417. Thanks a lot for contributing to OCA. ❤️

@carlos-lopez-tecnativa carlos-lopez-tecnativa deleted the 17.0-fix-project_task_default_stage branch March 13, 2025 18:28
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.

4 participants