Skip to content

Commit

Permalink
[ADD] project_task_description_template: new module to manage descrip…
Browse files Browse the repository at this point in the history
…tion templates for project tasks
  • Loading branch information
alan196 committed Jul 4, 2023
1 parent 8322083 commit fca7ec6
Show file tree
Hide file tree
Showing 17 changed files with 665 additions and 0 deletions.
80 changes: 80 additions & 0 deletions project_task_description_template/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
=================================
Project Task Description Template
=================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-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_description_template
: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_description_template
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/project&target_branch=15.0
:alt: Try me on Runboat

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

This module allow to define description templates for a task and use them to generate the description of the task.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module:

Select the description template you want to use in a task.

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_description_template%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
~~~~~~~

* Jarsa

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

* Alan Ramos <[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_description_template>`_ 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_description_template/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2023 - Jarsa
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).

from . import models
19 changes: 19 additions & 0 deletions project_task_description_template/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 - Jarsa
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
{
"name": "Project Task Description Template",
"summary": "Add a description template to project tasks",
"version": "15.0.1.0.0",
"category": "Project Management",
"author": "Jarsa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/project",
"license": "LGPL-3",
"installable": True,
"depends": ["project"],
"data": [
"security/ir.model.access.csv",
"security/ir_rule_data.xml",
"views/project_task_view.xml",
"views/project_task_description_template_view.xml",
],
}
Empty file.
5 changes: 5 additions & 0 deletions project_task_description_template/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2023 - Jarsa
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).

from . import project_task
from . import project_task_description_template
15 changes: 15 additions & 0 deletions project_task_description_template/models/project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 - Jarsa
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).

from odoo import api, fields, models


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

description_template_id = fields.Many2one("project.task.description.template")

@api.onchange("description_template_id")
def _onchange_description_template_id(self):
if self.description_template_id:
self.description += self.description_template_id.description
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 - Jarsa
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).

from odoo import fields, models


class ProjectTaskDescriptionTemplate(models.Model):
_name = "project.task.description.template"
_description = "Project Task Description Template"

name = fields.Char(required=True)
description = fields.Html(required=True)
active = fields.Boolean(default=True)
company_id = fields.Many2one("res.company", default=lambda self: self.env.company)
1 change: 1 addition & 0 deletions project_task_description_template/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Alan Ramos <[email protected]>
1 change: 1 addition & 0 deletions project_task_description_template/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allow to define description templates for a task and use them to generate the description of the task.
3 changes: 3 additions & 0 deletions project_task_description_template/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To use this module:

Select the description template you want to use in a task.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_model_project_task_description_template,access_model_project_task_description_template,model_project_task_description_template,project.group_project_manager,1,1,1,1
access_model_project_task_description_template_user,access_model_project_task_description_template_user,model_project_task_description_template,project.group_project_user,1,0,0,0
16 changes: 16 additions & 0 deletions project_task_description_template/security/ir_rule_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="project_task_description_template_company_ruyle" model="ir.rule">
<field name="name">Project Task Description Template Company Rule</field>
<field name="model_id" ref="model_project_task_description_template" />
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
<field name="perm_read" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_unlink" eval="True" />
</record>

</odoo>
Loading

0 comments on commit fca7ec6

Please sign in to comment.