Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions project_task_default_user/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
=========================
Project Task Default User
=========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ad4071f80cb9b713b83ef081af888e37e8b3a19dd0cde6415eecb13714542822
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github
:target: https://github.com/OCA/project/tree/18.0/project_task_default_user
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-18-0/project-18-0-project_task_default_user
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module automatically assigns default users to tasks

- Project-based: When creating a new task in a stage without default
users, it inherits the default users set on the project, if any.
Otherwise, no user is assigned automatically.
- Stage-based: When creating or moving a task to a stage with default
users, these users are automatically assigned, replacing any existing
users.
- Multiple default users can be set

**Table of contents**

.. contents::
:local:

Configuration
=============

To use this module, you need to:

1. Open the Project-settings > Set default users in "Default Users" page
tab
2. Activate the developer mode.
3. Open Project > Configuration > Task Stages. Set default users in
field "Default Users for this Stage"

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/project/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_task_default_user%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* NICO SOLUTIONS - ENGINEERING & IT

Contributors
------------

- `NICO SOLUTIONS - ENGINEERING &
IT <https://www.nico-solutions.de>`__:

- Nils Coenen <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-NICO-SOLUTIONS| image:: https://github.com/NICO-SOLUTIONS.png?size=40px
:target: https://github.com/NICO-SOLUTIONS
:alt: NICO-SOLUTIONS

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-NICO-SOLUTIONS|

This module is part of the `OCA/project <https://github.com/OCA/project/tree/18.0/project_task_default_user>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions project_task_default_user/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions project_task_default_user/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2025 NICO SOLUTIONS - ENGINEERING & IT
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
"name": "Project Task Default User",
"summary": "Auto assign default users to tasks or when changing task stages",
"version": "18.0.1.0.0",
"category": "project",
"author": "NICO SOLUTIONS - ENGINEERING & IT, Odoo Community Association (OCA)",
"maintainers": ["NICO-SOLUTIONS"],
"website": "https://github.com/OCA/project",
"depends": ["project"],
"data": [
"views/project_project_views.xml",
"views/project_task_type_views.xml",
],
"license": "AGPL-3",
"installable": True,
"application": False,
"auto_install": False,
}
5 changes: 5 additions & 0 deletions project_task_default_user/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import project_project
from . import project_task_type
from . import project_task
19 changes: 19 additions & 0 deletions project_task_default_user/models/project_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2025 NICO SOLUTIONS - ENGINEERING & IT
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import fields, models


class ProjectProject(models.Model):
_inherit = "project.project"

default_user_ids = fields.Many2many(
"res.users",
string="Default Users for Tasks",
domain=lambda self: [
("groups_id", "in", [self.env.ref("project.group_project_user").id])
],
help="If set, tasks will automatically be assigned to these users. "
"On new tasks, this applies if no users are set. On stage change, "
"the users are replaced only if the new stage has default users.",
)
42 changes: 42 additions & 0 deletions project_task_default_user/models/project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2025 NICO SOLUTIONS - ENGINEERING & IT
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import models


class ProjectTask(models.Model):
_inherit = "project.task"

def create(self, vals_list):
tasks = super().create(vals_list)

for task in tasks:
if not task.user_ids:
default_users = []

stage = task.stage_id
if stage and stage.default_user_ids:
default_users = stage.default_user_ids.ids

if (
not default_users
and task.project_id
and task.project_id.default_user_ids
):
default_users = task.project_id.default_user_ids.ids

if default_users:
task.user_ids = [(6, 0, default_users)]

return tasks

def write(self, vals):
res = super().write(vals)

if "stage_id" in vals:
for task in self:
stage = task.stage_id
if stage and stage.default_user_ids:
task.user_ids = [(6, 0, stage.default_user_ids.ids)]

return res
19 changes: 19 additions & 0 deletions project_task_default_user/models/project_task_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2025 NICO SOLUTIONS - ENGINEERING & IT
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import fields, models


class ProjectTaskType(models.Model):
_inherit = "project.task.type"

default_user_ids = fields.Many2many(
"res.users",
string="Default Users for this Stage",
domain=lambda self: [
("groups_id", "in", [self.env.ref("project.group_project_user").id])
],
help="If set, tasks will automatically be assigned to these users. "
"On new tasks, this applies if no users are set. On stage change, "
"the users are replaced only if the new stage has default users.",
)
3 changes: 3 additions & 0 deletions project_task_default_user/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions project_task_default_user/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you need to:

1. Open the Project-settings > Set default users in "Default Users" page tab
2. Activate the developer mode.
3. Open Project > Configuration > Task Stages. Set default users in field "Default Users for this Stage"
2 changes: 2 additions & 0 deletions project_task_default_user/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [NICO SOLUTIONS - ENGINEERING & IT](https://www.nico-solutions.de):
- Nils Coenen \<<[email protected]>\>
4 changes: 4 additions & 0 deletions project_task_default_user/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module automatically assigns default users to tasks
- Project-based: When creating a new task in a stage without default users, it inherits the default users set on the project, if any. Otherwise, no user is assigned automatically.
- Stage-based: When creating or moving a task to a stage with default users, these users are automatically assigned, replacing any existing users.
- Multiple default users can be set
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading