Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing from upstream OCA/project (15.0) #1098

Merged
merged 4 commits into from
Jan 24, 2025
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ addon | version | maintainers | summary
[project_task_note](project_task_note/) | 15.0.1.0.0 | [![carolina-fernandez](https://github.com/carolina-fernandez.png?size=30px)](https://github.com/carolina-fernandez) | Add notes in project tasks
[project_task_personal_stage_auto_fold](project_task_personal_stage_auto_fold/) | 15.0.1.0.3 | | Moves task to the first fold personal stage when done
[project_task_pull_request](project_task_pull_request/) | 15.0.1.0.1 | | Adds a field for a PR URI to project tasks
[project_task_required_project](project_task_required_project/) | 15.0.1.0.0 | | Obligation to specify a project when creating/editing a task
[project_task_stage_state](project_task_stage_state/) | 15.0.1.0.1 | | Restore State attribute removed from Project Stages in 8.0
[project_template](project_template/) | 15.0.1.0.0 | [![patrickrwilson](https://github.com/patrickrwilson.png?size=30px)](https://github.com/patrickrwilson) | Project Templates
[project_template_milestone](project_template_milestone/) | 15.0.1.0.0 | [![patrickrwilson](https://github.com/patrickrwilson.png?size=30px)](https://github.com/patrickrwilson) | Adds function to copy of milestones when creating a project from template
Expand Down
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:08c9438cdeec4fda37a6dde34797b349524f21a5cc74bdefa2f941214fc91fdc
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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",
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_required_project
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: project_task_required_project
#: code:addons/project_task_required_project/models/project_task.py:0
#, python-format
msgid "A project has not been selected for the task."
msgstr ""

#. module: project_task_required_project
#: model:ir.model,name:project_task_required_project.model_res_company
msgid "Companies"
msgstr ""

#. module: project_task_required_project
#: model:ir.model,name:project_task_required_project.model_res_config_settings
msgid "Config Settings"
msgstr ""

#. module: project_task_required_project
#: model_terms:ir.ui.view,arch_db:project_task_required_project.project_task_required_project_res_config_settings_view_form
msgid ""
"If it is active, selecting a project when creating or editing a task will be"
" required."
msgstr ""

#. module: project_task_required_project
#: model:ir.model.fields,field_description:project_task_required_project.field_res_company__is_project_required
#: model:ir.model.fields,field_description:project_task_required_project.field_res_config_settings__is_project_required
msgid "Project required on tasks"
msgstr ""

#. module: project_task_required_project
#: model:ir.model,name:project_task_required_project.model_project_task
msgid "Task"
msgstr ""
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
Loading