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

[14.0][mig] project_task_project_required #1081

Merged
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
86 changes: 86 additions & 0 deletions project_task_project_required/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
================================
Project: require Project on Task
================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/12.0/project_task_project_required
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-12-0/project-12-0-project_task_project_required
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/140/12.0
:alt: Try me on Runbot

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

This module allows to configure task as having project as a mandatory field.

**Table of contents**

.. contents::
:local:

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

By installing this module, the project field
will be mandatory for all the companies.

To make project selection optional on task for a given company:

# Go to *Project > Configuration > Settings*
# Uncheck *Require Projects on Tasks*

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_task_project_required%0Aversion:%2012.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
~~~~~~~

* CorporateHub

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

* `CorporateHub <https://corporatehub.eu/>`__

* Alexey Pelykh <[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/12.0/project_task_project_required>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions project_task_project_required/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
23 changes: 23 additions & 0 deletions project_task_project_required/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
# Copyright 2020 CorporateHub (https://corporatehub.eu)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Project: require Project on Task",
"summary": """
Set project on task as a mandatory field""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "CorporateHub, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/project",
"depends": [
"project",
],
"data": [
"views/project_task.xml",
"views/res_config_settings.xml",
],
"demo": [
"demo/res_company.xml",
],
}
16 changes: 16 additions & 0 deletions project_task_project_required/demo/res_company.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2022 - Today: GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<!-- Disable the feature on the demo company
to avoid error with other modules, when loading demo tasks
or executing tests -->
<record id="base.main_company" model="res.company">
<field name="is_project_task_project_required" eval="False" />
</record>

</odoo>
62 changes: 62 additions & 0 deletions project_task_project_required/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_project_required
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-05-31 10:09+0000\n"
"Last-Translator: Sergio Zanchetta <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"

#. module: project_task_project_required
#: model_terms:ir.ui.view,arch_db:project_task_project_required.res_config_settings_view_form
msgid "<span class=\"fa fa-lg fa-building-o\" title=\"Values set here are company-specific.\" role=\"img\" aria-label=\"Values set here are company-specific.\" groups=\"base.group_multi_company\"/>"
msgstr ""
"<span class=\"fa fa-lg fa-building-o\" title=\"I valori impostati qui sono "
"specifici per azienda.\" role=\"img\" aria-label=\"Values set here are "
"company-specific.\" groups=\"base.group_multi_company\"/>"

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

#. module: project_task_project_required
#: model:ir.model,name:project_task_project_required.model_res_config_settings
msgid "Config Settings"
msgstr "Impostazioni di configurazione"

#. module: project_task_project_required
#: model:ir.model.fields,field_description:project_task_project_required.field_project_task__is_project_required
msgid "Is Project Required"
msgstr ""

#. module: project_task_project_required
#: model:ir.model.fields,field_description:project_task_project_required.field_res_company__is_project_task_project_required
#: model:ir.model.fields,field_description:project_task_project_required.field_res_config_settings__is_project_task_project_required
msgid "Require Projects on Tasks"
msgstr ""

#. module: project_task_project_required
#: model_terms:ir.ui.view,arch_db:project_task_project_required.res_config_settings_view_form
msgid "Require project selection on each task by default"
msgstr ""

#. module: project_task_project_required
#: model:ir.model,name:project_task_project_required.model_project_task
msgid "Task"
msgstr "Lavoro"

#. module: project_task_project_required
#: code:addons/project_task_project_required/models/project_task.py:20
#, python-format
msgid "You must specify a project for the task."
msgstr "Deve essere specificato un progetto per il lavoro."
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_project_required
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.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_project_required
#: model_terms:ir.ui.view,arch_db:project_task_project_required.res_config_settings_view_form
msgid "<span class=\"fa fa-lg fa-building-o\" title=\"Values set here are company-specific.\" role=\"img\" aria-label=\"Values set here are company-specific.\" groups=\"base.group_multi_company\"/>"
msgstr ""

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

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

#. module: project_task_project_required
#: model:ir.model.fields,field_description:project_task_project_required.field_project_task__is_project_required
msgid "Is Project Required"
msgstr ""

#. module: project_task_project_required
#: model:ir.model.fields,field_description:project_task_project_required.field_res_company__is_project_task_project_required
#: model:ir.model.fields,field_description:project_task_project_required.field_res_config_settings__is_project_task_project_required
msgid "Require Projects on Tasks"
msgstr ""

#. module: project_task_project_required
#: model_terms:ir.ui.view,arch_db:project_task_project_required.res_config_settings_view_form
msgid "Require project selection on each task by default"
msgstr ""

#. module: project_task_project_required
#: model:ir.model,name:project_task_project_required.model_project_task
msgid "Task"
msgstr ""

#. module: project_task_project_required
#: code:addons/project_task_project_required/models/project_task.py:20
#, python-format
msgid "You must specify a project for the task."
msgstr ""

57 changes: 57 additions & 0 deletions project_task_project_required/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_project_required
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"

#. module: project_task_project_required
#: model_terms:ir.ui.view,arch_db:project_task_project_required.res_config_settings_view_form
msgid "<span class=\"fa fa-lg fa-building-o\" title=\"Values set here are company-specific.\" role=\"img\" aria-label=\"Values set here are company-specific.\" groups=\"base.group_multi_company\"/>"
msgstr ""

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

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

#. module: project_task_project_required
#: model:ir.model.fields,field_description:project_task_project_required.field_project_task__is_project_required
msgid "Is Project Required"
msgstr ""

#. module: project_task_project_required
#: model:ir.model.fields,field_description:project_task_project_required.field_res_company__is_project_task_project_required
#: model:ir.model.fields,field_description:project_task_project_required.field_res_config_settings__is_project_task_project_required
msgid "Require Projects on Tasks"
msgstr ""

#. module: project_task_project_required
#: model_terms:ir.ui.view,arch_db:project_task_project_required.res_config_settings_view_form
msgid "Require project selection on each task by default"
msgstr ""

#. module: project_task_project_required
#: model:ir.model,name:project_task_project_required.model_project_task
msgid "Task"
msgstr ""

#. module: project_task_project_required
#: code:addons/project_task_project_required/models/project_task.py:20
#, python-format
msgid "You must specify a project for the task."
msgstr ""
5 changes: 5 additions & 0 deletions project_task_project_required/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import res_company
from . import project_task
from . import res_config_settings
20 changes: 20 additions & 0 deletions project_task_project_required/models/project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


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

is_project_required = fields.Boolean(
string="Is Project Required",
related="company_id.is_project_task_project_required",
)

@api.constrains("project_id")
def _check_project_id(self):
for task in self:
if task.is_project_required and not task.project_id:
raise ValidationError(_("You must specify a project for the task."))
13 changes: 13 additions & 0 deletions project_task_project_required/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
# 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_task_project_required = fields.Boolean(
string="Require Projects on Tasks",
default=True,
)
14 changes: 14 additions & 0 deletions project_task_project_required/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2018-2019 Brainbean Apps (https://brainbeanapps.com)
# 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_task_project_required = fields.Boolean(
string="Require Projects on Tasks",
related="company_id.is_project_task_project_required",
readonly=False,
)
7 changes: 7 additions & 0 deletions project_task_project_required/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
By installing this module, the project field
will be mandatory for all the companies.

To make project selection optional on task for a given company:

# Go to *Project > Configuration > Settings*
# Uncheck *Require Projects on Tasks*
3 changes: 3 additions & 0 deletions project_task_project_required/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `CorporateHub <https://corporatehub.eu/>`__

* Alexey Pelykh <[email protected]>
1 change: 1 addition & 0 deletions project_task_project_required/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows to configure task as having project as a mandatory field.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading