Skip to content

Commit

Permalink
[MIG][16.0] project_task_description_template
Browse files Browse the repository at this point in the history
  • Loading branch information
rivo2302 committed Nov 22, 2024
1 parent ec7b6c0 commit d512ca3
Show file tree
Hide file tree
Showing 19 changed files with 306 additions and 0 deletions.
1 change: 1 addition & 0 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"depends": [
"project",
"project_task_date_planned",
"project_task_description_template",
"project_task_full_text_search",
"project_type_advanced",
"project_default_task_stage",
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ USER odoo

COPY project_stage_allow_timesheet mnt/extra-addons/project_stage_allow_timesheet
COPY project_task_date_planned /mnt/extra-addons/project_task_date_planned
COPY project_task_description_template /mnt/extra-addons/project_task_description_template
COPY project_task_full_text_search /mnt/extra-addons/project_task_full_text_search
COPY project_type_advanced /mnt/extra-addons/project_type_advanced
COPY project_default_task_stage /mnt/extra-addons/project_default_task_stage



COPY .docker_files/main /mnt/extra-addons/main
COPY .docker_files/odoo.conf /etc/odoo
34 changes: 34 additions & 0 deletions project_task_description_template/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Project Task Description Templates
==================================
This module allows to autocomplete descriptions on tasks.

.. contents:: Table of Contents

Context
-------
When using ``Projects`` for field interventions for example, the description of tasks is very repetitive.
It is therefore convenient to automatically fill the description with a template.

Usage
-----
As ``Project / Manager``, I go to ``Project / Configuration / Task Description Templates``.

I find the list of description templates.

.. image:: static/description/description_template_list.png

Each record contains a name and a HTML description.

.. image:: static/description/description_template_form.png

In the form view of a task, I can select a description template.

.. image:: static/description/task_form.png

The description is automatically copied from the template.

.. image:: static/description/task_form_description_filled.png

Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
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 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
20 changes: 20 additions & 0 deletions project_task_description_template/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{

Check warning on line 4 in project_task_description_template/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_task_description_template/__manifest__.py#L4

Statement seems to have no effect
"name": "Project Task Description Template",
"version": "16.0.1.0.0",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://www.numigi.com",
"license": "LGPL-3",
"category": "Project",
"summary": "Autocomplete task descriptions from templates",
"depends": ["project"],
"data": [
"security/ir.model.access.csv",
"views/project_task_views.xml",
"views/task_description_template_views.xml",
],
"installable": True,
}
104 changes: 104 additions & 0 deletions project_task_description_template/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_description_template
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-22 13:35+0000\n"
"PO-Revision-Date: 2024-11-22 13:35+0000\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_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__active
msgid "Active"
msgstr "Actif"

#. module: project_task_description_template
#: model_terms:ir.ui.view,arch_db:project_task_description_template.project_task_description_template_search
msgid "Archived"
msgstr "Archivé"

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__create_uid
msgid "Created by"
msgstr "Créé par"

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__create_date
msgid "Created on"
msgstr "Créé le"

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__description
msgid "Description"
msgstr ""

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task__description_template_id
msgid "Description Template"
msgstr "Modèle de description"

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__display_name
msgid "Display Name"
msgstr "Nom affiché"

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__id
msgid "ID"
msgstr ""

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__name
msgid "Name"
msgstr "Nom"

#. module: project_task_description_template
#: model:ir.model,name:project_task_description_template.model_project_task_description_template
msgid "Project Task Description Template"
msgstr "Modèles de description de tâches"

#. module: project_task_description_template
#: model:ir.model.fields,field_description:project_task_description_template.field_project_task_description_template__sequence
msgid "Sequence"
msgstr "Séquence"

#. module: project_task_description_template
#: model:ir.model,name:project_task_description_template.model_project_task
msgid "Task"
msgstr "Tâche"

#. module: project_task_description_template
#: model_terms:ir.ui.view,arch_db:project_task_description_template.project_task_description_template_form
msgid "Task Description Template"
msgstr "Modèle de description de tâche"

#. module: project_task_description_template
#: model:ir.actions.act_window,name:project_task_description_template.project_task_description_template_action
#: model:ir.ui.menu,name:project_task_description_template.project_task_description_template_menu
#: model_terms:ir.ui.view,arch_db:project_task_description_template.project_task_description_template_list
#: model_terms:ir.ui.view,arch_db:project_task_description_template.project_task_description_template_search
msgid "Task Description Templates"
msgstr "Modèles de description de tâches"
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 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import project_task

Check notice on line 4 in project_task_description_template/models/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_task_description_template/models/__init__.py#L4

'.project_task' imported but unused (F401)
from . import project_task_description_template

Check notice on line 5 in project_task_description_template/models/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_task_description_template/models/__init__.py#L5

'.project_task_description_template' imported but unused (F401)
18 changes: 18 additions & 0 deletions project_task_description_template/models/project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class ProjectTask(models.Model):

_inherit = "project.task"

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

@api.onchange("description_template_id")
def _onchange_description_template(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,16 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProjectTaskDescriptionTemplate(models.Model):

_name = "project.task.description.template"
_description = "Project Task Description Template"
_order = "sequence"

name = fields.Char(required=True)
description = fields.Html()
active = fields.Boolean(default=True)
sequence = fields.Integer()
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_project_task_description_template_user,project_task_description_template_user,model_project_task_description_template,base.group_user,1,0,0,0
access_project_task_description_template_manager,project_task_description_template_manager,model_project_task_description_template,project.group_project_manager,1,1,1,1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions project_task_description_template/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_project_task
20 changes: 20 additions & 0 deletions project_task_description_template/tests/test_project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests import Form
from odoo.tests.common import TransactionCase


class TestProjectTask(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.template = cls.env["project.task.description.template"].create(
{"name": "My Template", "description": "Lorem Ipsum"}
)
cls.task = cls.env["project.task"].create({"name": "My Task"})

def test_onchange_description_template(self):
with Form(self.task) as task_form:
task_form.description_template_id = self.template
assert self.task.description == self.template.description
15 changes: 15 additions & 0 deletions project_task_description_template/views/project_task_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="view_task_form2" model="ir.ui.view">
<field name="name">Task form: Add description template</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<field name="user_ids" position="after">
<field name="description_template_id"/>
</field>
</field>
</record>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>

<record id="project_task_description_template_form" model="ir.ui.view">
<field name="name">Task Description Template Form</field>
<field name="model">project.task.description.template</field>
<field name="arch" type="xml">
<form string="Task Description Template">
<header>
</header>
<sheet>
<group>
<field name="name"/>
<field name="description" widget="html"/>
<field name="sequence"/>
<field name="active"/>
</group>
</sheet>
</form>
</field>
</record>

<record id="project_task_description_template_list" model="ir.ui.view">
<field name="name">Task Description Template List</field>
<field name="model">project.task.description.template</field>
<field name="arch" type="xml">
<tree string="Task Description Templates">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="active"/>
</tree>
</field>
</record>

<record id="project_task_description_template_search" model="ir.ui.view">
<field name="name">Task Description Template Search</field>
<field name="model">project.task.description.template</field>
<field name="arch" type="xml">
<search string="Task Description Templates">
<field name="name"/>
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
</search>
</field>
</record>

<record id="project_task_description_template_action" model="ir.actions.act_window">
<field name="name">Task Description Templates</field>
<field name="res_model">project.task.description.template</field>
<field name="view_mode">tree,form</field>
</record>

<menuitem
id="project_task_description_template_menu"
name="Task Description Templates"
parent="project.menu_project_config"
action="project_task_description_template_action"
sequence="200"
/>

</odoo>

0 comments on commit d512ca3

Please sign in to comment.