Skip to content

[19.0][MIG] project_task_default_user: Migration to 19.0#1725

Open
NICO-SOLUTIONS wants to merge 2 commits into
OCA:19.0from
NICO-SOLUTIONS:19.0-mig-project_task_default_user
Open

[19.0][MIG] project_task_default_user: Migration to 19.0#1725
NICO-SOLUTIONS wants to merge 2 commits into
OCA:19.0from
NICO-SOLUTIONS:19.0-mig-project_task_default_user

Conversation

@NICO-SOLUTIONS
Copy link
Copy Markdown
Member

  • Migrate relational field commands to Command API
  • Adapt test data for Odoo 19 API changes (groups, M2M handling)
  • Fix failing tests after migration from 18.0
  • Keep existing default user assignment logic unchanged

This module automatically assigns default users to tasks:
- Stage-based (priority rule): When creating a task or changing its stage to one with default users, stage users are applied with a configurable assignment mode (replace or merge). Stage defaults always take priority over project defaults.
- Project-based fallback: If the stage does not define any default users, project default users are applied with the same assignment mode logic.
- Assignment behavior:
  - replace: replaces existing task users with default users
  - merge: adds default users to existing task users without removing them
- Multiple default users can be configured on both projects and stages.

[UPD] Update project_task_default_user.pot

[BOT] post-merge updates
- Migrate relational field commands to Command API
- Adapt test data for Odoo 19 API changes (groups, M2M handling)
- Fix failing tests after migration from 18.0
- Keep existing default user assignment logic unchanged
@OCA-git-bot OCA-git-bot added series:19.0 mod:project_task_default_user Module project_task_default_user labels May 11, 2026
@NICO-SOLUTIONS NICO-SOLUTIONS changed the title 19.0][MIG] project_task_default_user: Migration to 19.0 [19.0][MIG] project_task_default_user: Migration to 19.0 May 11, 2026
@NICO-SOLUTIONS NICO-SOLUTIONS marked this pull request as ready for review May 11, 2026 12:38
@NICO-SOLUTIONS NICO-SOLUTIONS mentioned this pull request May 11, 2026
42 tasks
@NICO-SOLUTIONS
Copy link
Copy Markdown
Member Author

@CRogos

Would you mind taking a look?

Copy link
Copy Markdown
Contributor

@CRogos CRogos left a comment

Choose a reason for hiding this comment

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

Migration LGTM code + tested.

Not sure if default could get into confusion with the build-in user defined defaults.

Image

I am also not sure if there is a more generic solution with base.automation. I agree that the UI here is easier to use, but maybe use technically base.automation in the background? (just loud thinking)

Comment thread project_task_default_user/models/project_task_type.py
@NICO-SOLUTIONS
Copy link
Copy Markdown
Member Author

@CRogos
Thanks for the input — I see where you're coming from regarding base.automation.

In this case I don't think it's the best fit. The assignment logic is quite tightly coupled to project/stage behavior and the replace/merge strategy. With automations we would likely still end up writing custom Python logic, which in my view would make things harder to maintain, debug and reason about. Keeping this in the model layer feels more explicit and deterministic for this use case.

Regarding the default_* naming: I checked the related core usage, and the pattern is indeed used for context defaults (e.g. default_user_ids in context). That said, I don't see a realistic risk of breaking behavior here.

The core snippet only affects the initial default evaluation of user_ids during task creation via context-based defaults.

This implementation doesn't interfere with that mechanism, since we neither inject default_user_ids into the context nor override default_get. Also, the fields in this module live on project.project and project.task.type, while the referenced core logic is scoped to project.task.

Overall, while the concern is valid from a theoretical standpoint, I don't see a practical path where this would lead to conflicts with the core behavior.

Copy link
Copy Markdown

@WesleyOliveira98 WesleyOliveira98 left a comment

Choose a reason for hiding this comment

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

LGTM

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants