Skip to content
Open
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
99 changes: 99 additions & 0 deletions project_task_description_template_section/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=========================================
Project Task Description Template Section
=========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:34ca4da542975d14976a4e9fcb3b71602a2ce3bdf45f34e5f022e09fb866c3d5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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-sygel--technology%2Fsy--project-lightgray.png?logo=github
:target: https://github.com/sygel-technology/sy-project/tree/17.0/project_task_description_template_section
:alt: sygel-technology/sy-project

|badge1| |badge2| |badge3|

This module extends the functionality of
project_task_description_template to add two functionalities:

- Select in the task description template if it is inserted above or
under the current description of the task
- Select in the task description template if it will be inserted in the
task description with a delimiter

**Table of contents**

.. contents::
:local:

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

To configure this module, you need to:

- Go to Project / Configuration / Task Description Templates. And
create or open a description template.
- Fill the new template order, section, section name and section with
date fields.

Usage
=====

To use this module:

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

Known issues / Roadmap
======================

The section delimiter is an html tag, not text. It has some little
issues:

- It can not be copied and pasted.
- To be deleted, you need to select with the cursor the text from abobe
and under it.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/sygel-technology/sy-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/sygel-technology/sy-project/issues/new?body=module:%20project_task_description_template_section%0Aversion:%2017.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
------------

- Harald Panten harald.panten@sygel.es
- Valentin Vinagre valentin.vinagre@sygel.es
- Alberto Martínez alberto.martinez@sygel.es

Maintainers
-----------

This module is part of the `sygel-technology/sy-project <https://github.com/sygel-technology/sy-project/tree/17.0/project_task_description_template_section>`_ project on GitHub.

You are welcome to contribute.
3 changes: 3 additions & 0 deletions project_task_description_template_section/__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
19 changes: 19 additions & 0 deletions project_task_description_template_section/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Project Task Description Template Section",
"summary": "Project Task Description Template Section",
"version": "17.0.1.0.0",
"category": "Project",
"website": "https://github.com/sygel-technology/sy-project",
"author": "Sygel, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"project_task_description_template",
],
"data": [
"views/project_task_description_template_view.xml",
],
}
83 changes: 83 additions & 0 deletions project_task_description_template_section/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_description_template_section
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-18 07:55+0000\n"
"PO-Revision-Date: 2024-10-18 09:58+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.0.1\n"

#. module: project_task_description_template_section
#: model:ir.model.fields.selection,name:project_task_description_template_section.selection__project_task_description_template__section_delimiter_style__dashed
msgid "Dashed"
msgstr "Discontinuo"

#. module: project_task_description_template_section
#: model:ir.model.fields.selection,name:project_task_description_template_section.selection__project_task_description_template__template_order__down
msgid "Down"
msgstr "Debajo"

#. module: project_task_description_template_section
#: model:ir.model,name:project_task_description_template_section.model_project_task_description_template
msgid "Project Task Description Template"
msgstr "Plantilla de descripción de tareas"

#. module: project_task_description_template_section
#: model:ir.model.fields,field_description:project_task_description_template_section.field_project_task_description_template__section
msgid "Section"
msgstr "Sección"

#. module: project_task_description_template_section
#: model:ir.model.fields,field_description:project_task_description_template_section.field_project_task_description_template__section_delimiter_footer
msgid "Section Delimiter Footer"
msgstr "Pie de página delimitador de sección"

#. module: project_task_description_template_section
#: model:ir.model.fields,field_description:project_task_description_template_section.field_project_task_description_template__section_delimiter_header
msgid "Section Delimiter Header"
msgstr "Encabezado delimitador de sección"

#. module: project_task_description_template_section
#: model:ir.model.fields,field_description:project_task_description_template_section.field_project_task_description_template__section_delimiter_style
msgid "Section Delimiter Style"
msgstr "Estilo del delimitador"

#. module: project_task_description_template_section
#: model:ir.model.fields,field_description:project_task_description_template_section.field_project_task_description_template__section_name
msgid "Section Name"
msgstr "Nombre de sección"

#. module: project_task_description_template_section
#: model:ir.model.fields,field_description:project_task_description_template_section.field_project_task_description_template__section_with_date
msgid "Section With Date"
msgstr "Sección con fecha"

#. module: project_task_description_template_section
#: model:ir.model.fields.selection,name:project_task_description_template_section.selection__project_task_description_template__section_delimiter_style__solid
msgid "Solid"
msgstr "Solido"

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

#. module: project_task_description_template_section
#: model:ir.model.fields,field_description:project_task_description_template_section.field_project_task_description_template__template_order
msgid "Template Order"
msgstr "Orden de la plantilla"

#. module: project_task_description_template_section
#: model:ir.model.fields.selection,name:project_task_description_template_section.selection__project_task_description_template__template_order__up
msgid "Up"
msgstr "Arriba"
4 changes: 4 additions & 0 deletions project_task_description_template_section/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import project_task
from . import project_task_description_template
34 changes: 34 additions & 0 deletions project_task_description_template_section/models/project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2024 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


from odoo import api, models


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

@api.onchange("description_template_id")
def _onchange_description_template_id(self):
res = None
if self.description_template_id:
description = self.description if self.description else ""
if self.description_template_id.template_order == "Down":
self.description = (
description + self.description_template_id.section_delimiter_header
)
res = super()._onchange_description_template_id()
self.description = (
self.description
+ self.description_template_id.section_delimiter_footer
)
elif self.description_template_id.template_order == "Up":
self.description = (
self.description_template_id.section_delimiter_header
+ self.description_template_id.description
+ self.description_template_id.section_delimiter_footer
+ description
)
else:
res = super()._onchange_description_template_id()
return res
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2024 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import datetime

from odoo import api, fields, models


class ProjectTaskDescriptionTemplate(models.Model):
_inherit = "project.task.description.template"

template_order = fields.Selection(
selection=[("Up", "Up"), ("Down", "Down")],
default="Down",
required=True,
)
section = fields.Boolean()
section_name = fields.Char()
section_with_date = fields.Boolean()
section_delimiter_style = fields.Selection(
selection=[
("dashed", "Dashed"),
("solid", "Solid"),
],
default="dashed",
required=True,
)
section_delimiter_header = fields.Html(compute="_compute_section_delimiter")
section_delimiter_footer = fields.Html(compute="_compute_section_delimiter")

@api.depends("section", "section_name", "section_with_date")
def _compute_section_delimiter(self):
for rec in self:
if rec.section:
centered_text = (
f" {rec.section_name or ''}"
f" {datetime.date.today().strftime('%d/%m/%Y')} "
if rec.section_with_date
else f" {rec.section_name or ''} "
)
style = rec.section_delimiter_style
rec.section_delimiter_header = f"""
<p><br/><p>
<div style="display: flex; align-items: center;">
<hr style="flex-grow: 1; border-top: 1px {style} black;"/>
<span style="padding: 0 10px;">{centered_text}</span>
<hr style="flex-grow: 1; border-top: 1px {style} black;"/>
</div>
"""
rec.section_delimiter_footer = f"""
<div style="display: flex; align-items: center;">
<hr style="flex-grow: 1; border-top: 1px {style} black;"/>
</div>
<p><br/><p>
"""
else:
rec.section_delimiter_header = ""
rec.section_delimiter_footer = ""
3 changes: 3 additions & 0 deletions project_task_description_template_section/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions project_task_description_template_section/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To configure this module, you need to:

- Go to Project / Configuration / Task Description Templates. And create or open a description template.
- Fill the new template order, section, section name and section with date fields.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Harald Panten <harald.panten@sygel.es>
- Valentin Vinagre <valentin.vinagre@sygel.es>
- Alberto Martínez <alberto.martinez@sygel.es>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module extends the functionality of project_task_description_template to add two functionalities:

- Select in the task description template if it is inserted above or under the current description of the task
- Select in the task description template if it will be inserted in the task description with a delimiter
3 changes: 3 additions & 0 deletions project_task_description_template_section/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The section delimiter is an html <hr> tag, not text. It has some little issues:
- It can not be copied and pasted.
- To be deleted, you need to select with the cursor the text from abobe and under it.
3 changes: 3 additions & 0 deletions project_task_description_template_section/readme/USAGE.md
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading