Skip to content

Commit

Permalink
[MIG] project_task_add_very_high: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Jan 9, 2025
1 parent 4047123 commit 6ed63dc
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 15 deletions.
15 changes: 8 additions & 7 deletions project_task_add_very_high/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Project Task Add Very High
: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/17.0/project_task_add_very_high
:target: https://github.com/OCA/project/tree/18.0/project_task_add_very_high
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-17-0/project-17-0-project_task_add_very_high
:target: https://translation.odoo-community.org/projects/project-18-0/project-18-0-project_task_add_very_high
: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=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -82,7 +82,7 @@ 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_add_very_high%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_task_add_very_high%0Aversion:%2018.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.

Expand All @@ -97,8 +97,9 @@ Authors
Contributors
------------

- Andrea Stirpe <[email protected]>
- Yves Goldberg (Ygol InternetWork) [email protected]
- Andrea Stirpe <[email protected]>
- Yves Goldberg (Ygol InternetWork) [email protected]
- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_

Maintainers
-----------
Expand All @@ -121,6 +122,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-astirpe|

This module is part of the `OCA/project <https://github.com/OCA/project/tree/17.0/project_task_add_very_high>`_ project on GitHub.
This module is part of the `OCA/project <https://github.com/OCA/project/tree/18.0/project_task_add_very_high>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion project_task_add_very_high/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Project Task Add Very High",
"summary": "Adds extra options 'High' and 'Very High' on tasks",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"development_status": "Production/Stable",
"author": "Onestein, Odoo Community Association (OCA)",
"maintainers": ["astirpe"],
Expand Down
1 change: 1 addition & 0 deletions project_task_add_very_high/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Andrea Stirpe \<<[email protected]>\>
- Yves Goldberg (Ygol InternetWork) <[email protected]>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_
18 changes: 11 additions & 7 deletions project_task_add_very_high/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">Project Task Add Very High</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ae55a9b6aa58ebee08506e9cf834e58d37bc6cae4e77fab50c4963138e9c730e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/project/tree/17.0/project_task_add_very_high"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/project-17-0/project-17-0-project_task_add_very_high"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/project&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/project/tree/18.0/project_task_add_very_high"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/project-18-0/project-18-0-project_task_add_very_high"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/project&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the field priority in project tasks, adding two new
levels of priority. The two new levels of priority are: High and Very
High.</p>
Expand Down Expand Up @@ -415,7 +416,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/project/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/project/issues/new?body=module:%20project_task_add_very_high%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/project/issues/new?body=module:%20project_task_add_very_high%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -431,18 +432,21 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li>Andrea Stirpe &lt;<a class="reference external" href="mailto:a.stirpe&#64;onestein.nl">a.stirpe&#64;onestein.nl</a>&gt;</li>
<li>Yves Goldberg (Ygol InternetWork) <a class="reference external" href="mailto:yves&#64;ygol.com">yves&#64;ygol.com</a></li>
<li><tt class="docutils literal">Heliconia Solutions Pvt. Ltd. <span class="pre">&lt;https://www.heliconia.io&gt;</span></tt>_</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/astirpe"><img alt="astirpe" src="https://github.com/astirpe.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/17.0/project_task_add_very_high">OCA/project</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/18.0/project_task_add_very_high">OCA/project</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions project_task_add_very_high/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_project_task
97 changes: 97 additions & 0 deletions project_task_add_very_high/tests/test_project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
from odoo.tests.common import TransactionCase


class TestProjectTaskPriority(TransactionCase):
def setUp(self):
super().setUp()
self.project_task_model = self.env["project.task"]

def test_priority_selection(self):
"""Test that the priority field includes the new options."""
# Get the priority field definition
priority_field = self.project_task_model.fields_get(allfields=["priority"])[
"priority"
]

# Verify the new priority options are included
expected_options = [("2", "Very High"), ("3", "Most Important")]
for option in expected_options:
self.assertIn(
option,
priority_field["selection"],
f"{option} not found in priority selection",
)

def test_create_task_with_new_priority(self):
"""Test creating tasks with the new priorities."""
# Create a task with the new priority "Very High"
task = self.project_task_model.create(
{
"name": "Test Very High Priority Task",
"priority": "2",
}
)
self.assertEqual(task.priority, "2", "Task priority should be '2' (Very High)")

# Create a task with the new priority "Most Important"
task = self.project_task_model.create(
{
"name": "Test Most Important Priority Task",
"priority": "3",
}
)
self.assertEqual(
task.priority, "3", "Task priority should be '3' (Most Important)"
)

def test_update_priority(self):
"""Test updating task priority."""
# Create a task with a default priority
task = self.project_task_model.create({"name": "Test Task"})
self.assertEqual(task.priority, "0", "Default task priority should be '0'")

# Update the priority to "Very High"
task.write({"priority": "2"})
self.assertEqual(
task.priority, "2", "Task priority should be updated to '2' (Very High)"
)

# Update the priority to "Most Important"
task.write({"priority": "3"})
self.assertEqual(
task.priority,
"3",
"Task priority should be updated to '3' (Most Important)",
)

def test_invalid_priority(self):
"""Test that an invalid priority value raises an error."""
with self.assertRaises(
ValueError, msg="Invalid priority should raise ValueError"
):
self.project_task_model.create(
{"name": "Invalid Priority Task", "priority": "99"}
)

def test_priority_mass_update(self):
"""Test mass update of priority from '2' and '3' to '1'."""
# Create tasks with priorities "2" and "3"
task_very_high = self.project_task_model.create(
{"name": "Task Very High", "priority": "2"}
)
task_most_important = self.project_task_model.create(
{"name": "Task Most Important", "priority": "3"}
)

# Execute the hook line
self.env["project.task"].sudo().search([("priority", "in", ["2", "3"])]).write(
{"priority": "1"}
)

# Assert the priorities are updated
self.assertEqual(
task_very_high.priority, "1", "Task priority should be updated to '1'"
)
self.assertEqual(
task_most_important.priority, "1", "Task priority should be updated to '1'"
)

0 comments on commit 6ed63dc

Please sign in to comment.