Skip to content

Commit

Permalink
Merge PR #1417 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by leemannd
  • Loading branch information
OCA-git-bot committed Jan 23, 2025
2 parents 6fcc1e1 + e439ee1 commit 1b72d21
Show file tree
Hide file tree
Showing 18 changed files with 719 additions and 0 deletions.
97 changes: 97 additions & 0 deletions project_task_required_project/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
=============================
Project Task Required Project
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:65c9d50d3abd09a088429bc2ef38dfbe6bc99d8c990be03adb8f2f531dc7367a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/15.0/project_task_required_project
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-15-0/project-15-0-project_task_required_project
: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=15.0
:alt: Try me on Runboat

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

This module makes it mandatory to select a project when editing or creating a task.

**Table of contents**

.. contents::
:local:

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

To configure this module, you need to::

#. Go to Settings -> Project.
#. In the 'Tasks Management' section activate the 'Project Required' option and save the changes.

Usage
=====

To use this module, you need to:

#. Go to Project module.
#. Go to Tasks.
#. Edit or create a new Task.
#. If you not select a project, an error message will be displayed.

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_required_project%0Aversion:%2015.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
~~~~~~~

* Sygel

Contributors
~~~~~~~~~~~~

* `Sygel <https://sygel.es>`_:
* Ángel García de la Chica Herrera <[email protected]>
* Harald Panten <[email protected]>
* Valentín Vinagre <[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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions project_task_required_project/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2025 Ángel García de la Chica Herrera<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
18 changes: 18 additions & 0 deletions project_task_required_project/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 Ángel García de la Chica <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Project Task Required Project",
"summary": "Obligation to specify a project when creating/editing a task",
"version": "15.0.1.0.0",
"category": "Project",
"website": "https://github.com/OCA/project",
"author": "Sygel, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["project"],
"data": [
"views/res_config_settings_views.xml",
],
}
6 changes: 6 additions & 0 deletions project_task_required_project/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2025 Ángel García de la Chica Herrera <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import project_task
from . import res_company
from . import res_config_settings
17 changes: 17 additions & 0 deletions project_task_required_project/models/project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2025 Ángel García de la Chica Herrera <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, models
from odoo.exceptions import UserError


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

@api.constrains("project_id")
def _check_project_id_not_null(self):
if any(
record.company_id.is_project_required and not record.project_id
for record in self
):
raise UserError(_("A project has not been selected for the task."))
12 changes: 12 additions & 0 deletions project_task_required_project/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2025 Ángel García de la Chica Herrera <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

is_project_required = fields.Boolean(
default=False, string="Project required on tasks"
)
15 changes: 15 additions & 0 deletions project_task_required_project/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2025 Ángel García de la Chica Herrera <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

is_project_required = fields.Boolean(
related="company_id.is_project_required",
store=True,
readonly=False,
string="Project required on tasks",
)
4 changes: 4 additions & 0 deletions project_task_required_project/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To configure this module, you need to::

#. Go to Settings -> Project.
#. In the 'Tasks Management' section activate the 'Project Required' option and save the changes.
4 changes: 4 additions & 0 deletions project_task_required_project/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Sygel <https://sygel.es>`_:
* Ángel García de la Chica Herrera <[email protected]>
* Harald Panten <[email protected]>
* Valentín Vinagre <[email protected]>
1 change: 1 addition & 0 deletions project_task_required_project/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module makes it mandatory to select a project when editing or creating a task.
6 changes: 6 additions & 0 deletions project_task_required_project/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To use this module, you need to:

#. Go to Project module.
#. Go to Tasks.
#. Edit or create a new Task.
#. If you not select a project, an error message will be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1b72d21

Please sign in to comment.