Skip to content

Commit 633f48d

Browse files
[MIG] sale_project_task_recurrency: Migration to 18.0
1 parent c6a83f9 commit 633f48d

File tree

6 files changed

+159
-12
lines changed

6 files changed

+159
-12
lines changed

sale_project_task_recurrency/README.rst

+7-5
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Sale project task recurrency
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github
20-
:target: https://github.com/OCA/project/tree/17.0/sale_project_task_recurrency
20+
:target: https://github.com/OCA/project/tree/18.0/sale_project_task_recurrency
2121
:alt: OCA/project
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/project-17-0/project-17-0-sale_project_task_recurrency
23+
:target: https://translation.odoo-community.org/projects/project-18-0/project-18-0-sale_project_task_recurrency
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -66,7 +66,7 @@ Bug Tracker
6666
Bugs are tracked on `GitHub Issues <https://github.com/OCA/project/issues>`_.
6767
In case of trouble, please check there if your issue has already been reported.
6868
If you spotted it first, help us to smash it by providing a detailed and welcomed
69-
`feedback <https://github.com/OCA/project/issues/new?body=module:%20sale_project_task_recurrency%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
69+
`feedback <https://github.com/OCA/project/issues/new?body=module:%20sale_project_task_recurrency%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
7070

7171
Do not contact contributors directly about support or help with technical issues.
7272

@@ -86,6 +86,8 @@ Contributors
8686
- Pedro M. Baeza
8787
- Carlos López
8888

89+
- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_
90+
8991
Maintainers
9092
-----------
9193

@@ -99,6 +101,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
99101
mission is to support the collaborative development of Odoo features and
100102
promote its widespread use.
101103

102-
This module is part of the `OCA/project <https://github.com/OCA/project/tree/17.0/sale_project_task_recurrency>`_ project on GitHub.
104+
This module is part of the `OCA/project <https://github.com/OCA/project/tree/18.0/sale_project_task_recurrency>`_ project on GitHub.
103105

104106
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

sale_project_task_recurrency/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33
{
44
"name": "Sale project task recurrency",
5-
"version": "17.0.1.2.0",
5+
"version": "18.0.1.0.0",
66
"summary": "Configuring Task Recurrence from the Product Form.",
77
"author": "Tecnativa,Odoo Community Association (OCA)",
88
"website": "https://github.com/OCA/project",

sale_project_task_recurrency/models/product_template.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class ProductTemplate(models.Model):
8181
("2", "Second month"),
8282
("3", "Third month"),
8383
],
84-
"Force Month",
84+
"Force Month Quarter",
8585
help="Force the month to be used inside the quarter",
8686
)
8787
task_force_month_semester = fields.Selection(
@@ -93,7 +93,7 @@ class ProductTemplate(models.Model):
9393
("5", "Fifth month"),
9494
("6", "Sixth month"),
9595
],
96-
"Force Month",
96+
"Force Month Semester",
9797
help="Force the month to be used inside the semester",
9898
)
9999

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
- [Tecnativa](https://www.tecnativa.com):
22
- Pedro M. Baeza
3-
- Carlos López
3+
- Carlos López
4+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_

sale_project_task_recurrency/static/description/index.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Sale project task recurrency</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:d5da2188db2ac87ba6c4ebb660e25aa1e53a534b122f01791f97e48ae666a311
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/sale_project_task_recurrency"><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-sale_project_task_recurrency"><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>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/sale_project_task_recurrency"><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-sale_project_task_recurrency"><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>
373373
<p>This module allows configuring the recurrence of tasks created from
374374
sales orders directly in the product form.</p>
375375
<p><strong>Table of contents</strong></p>
@@ -418,7 +418,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
418418
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/project/issues">GitHub Issues</a>.
419419
In case of trouble, please check there if your issue has already been reported.
420420
If you spotted it first, help us to smash it by providing a detailed and welcomed
421-
<a class="reference external" href="https://github.com/OCA/project/issues/new?body=module:%20sale_project_task_recurrency%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
421+
<a class="reference external" href="https://github.com/OCA/project/issues/new?body=module:%20sale_project_task_recurrency%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
422422
<p>Do not contact contributors directly about support or help with technical issues.</p>
423423
</div>
424424
<div class="section" id="credits">
@@ -437,6 +437,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
437437
<li>Carlos López</li>
438438
</ul>
439439
</li>
440+
<li><tt class="docutils literal">Heliconia Solutions Pvt. Ltd. <span class="pre">&lt;https://www.heliconia.io&gt;</span></tt>_</li>
440441
</ul>
441442
</div>
442443
<div class="section" id="maintainers">
@@ -448,7 +449,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
448449
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
449450
mission is to support the collaborative development of Odoo features and
450451
promote its widespread use.</p>
451-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/17.0/sale_project_task_recurrency">OCA/project</a> project on GitHub.</p>
452+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/18.0/sale_project_task_recurrency">OCA/project</a> project on GitHub.</p>
452453
<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>
453454
</div>
454455
</div>

sale_project_task_recurrency/tests/test_product_task_recurrency.py

+143
Original file line numberDiff line numberDiff line change
@@ -1141,3 +1141,146 @@ def test_task_recurrency_semester_force_month(self):
11411141
self.assertEqual(
11421142
task.date_deadline.date(), fields.Date.from_string("2025-04-30")
11431143
)
1144+
1145+
def test_service_tracking_onchange(self):
1146+
"""Test the onchange behavior of service_tracking field for both
1147+
product.template and product.product models"""
1148+
1149+
# Test product.template onchange
1150+
template = self.service_task_recurrency.product_tmpl_id
1151+
self.assertTrue(template.recurring_task)
1152+
1153+
# Test changing to 'no' service tracking
1154+
template.service_tracking = "no"
1155+
template._onchange_service_tracking()
1156+
self.assertFalse(template.recurring_task)
1157+
1158+
# Test changing back to task_global_project
1159+
template.service_tracking = "task_global_project"
1160+
template._onchange_service_tracking()
1161+
# Note: changing service_tracking doesn't automatically re-enable recurring_task
1162+
self.assertFalse(template.recurring_task)
1163+
1164+
# Test changing to 'task_in_project'
1165+
template.recurring_task = True
1166+
template.service_tracking = "task_in_project"
1167+
template._onchange_service_tracking()
1168+
self.assertTrue(template.recurring_task)
1169+
1170+
# Test changing to 'project_only'
1171+
template.service_tracking = "project_only"
1172+
template._onchange_service_tracking()
1173+
self.assertFalse(template.recurring_task)
1174+
1175+
# Test product.product onchange
1176+
product = self.service_task_recurrency
1177+
product.recurring_task = True
1178+
1179+
# Test changing to 'no' service tracking
1180+
product.service_tracking = "no"
1181+
product._onchange_service_tracking()
1182+
self.assertFalse(product.recurring_task)
1183+
1184+
# Test changing back to task_global_project
1185+
product.service_tracking = "task_global_project"
1186+
product._onchange_service_tracking()
1187+
# Note: changing service_tracking doesn't automatically re-enable recurring_task
1188+
self.assertFalse(product.recurring_task)
1189+
1190+
# Test changing to 'task_in_project'
1191+
product.recurring_task = True
1192+
product.service_tracking = "task_in_project"
1193+
product._onchange_service_tracking()
1194+
self.assertTrue(product.recurring_task)
1195+
1196+
# Test changing to 'project_only'
1197+
product.service_tracking = "project_only"
1198+
product._onchange_service_tracking()
1199+
self.assertFalse(product.recurring_task)
1200+
1201+
def test_service_tracking_create_variants(self):
1202+
# Create a product attribute and value
1203+
attribute = self.env["product.attribute"].create(
1204+
{
1205+
"name": "Test Attribute",
1206+
}
1207+
)
1208+
val1 = self.env["product.attribute.value"].create(
1209+
{"name": "Value 1", "attribute_id": attribute.id}
1210+
)
1211+
val2 = self.env["product.attribute.value"].create(
1212+
{"name": "Value 2", "attribute_id": attribute.id}
1213+
)
1214+
1215+
# Create a product template with the service tracking and recurring task
1216+
template = self.env["product.template"].create(
1217+
{
1218+
"name": "Test Service with Variants",
1219+
"type": "service",
1220+
"service_tracking": "task_global_project",
1221+
"recurring_task": True,
1222+
"attribute_line_ids": [
1223+
(
1224+
0,
1225+
0,
1226+
{
1227+
"attribute_id": attribute.id,
1228+
"value_ids": [(6, 0, [val1.id, val2.id])],
1229+
},
1230+
)
1231+
],
1232+
}
1233+
)
1234+
1235+
# Create product variants
1236+
variants = template.product_variant_ids
1237+
1238+
# Ensure recurring_task is set on variants
1239+
for variant in variants:
1240+
self.assertTrue(variant.recurring_task)
1241+
1242+
# Change service_tracking to task_in_project
1243+
variant = variants[0] # Assuming the first variant
1244+
variant.service_tracking = "task_in_project"
1245+
variant._onchange_service_tracking()
1246+
1247+
# Assert that recurring_task is now True after service_tracking change
1248+
self.assertTrue(variant.recurring_task)
1249+
1250+
def test_service_tracking_edge_cases(self):
1251+
"""Test edge cases and special scenarios for service tracking"""
1252+
1253+
product = self.service_task_recurrency
1254+
1255+
# Test rapid changes in service tracking
1256+
service_tracking_values = [
1257+
"no",
1258+
"task_global_project",
1259+
"project_only",
1260+
"task_in_project",
1261+
]
1262+
for tracking in service_tracking_values:
1263+
product.recurring_task = True
1264+
product.service_tracking = tracking
1265+
product._onchange_service_tracking()
1266+
if tracking in ["task_global_project", "task_in_project"]:
1267+
self.assertTrue(product.recurring_task)
1268+
else:
1269+
self.assertFalse(product.recurring_task)
1270+
1271+
# Test changing service tracking with recurring task enabled/disabled
1272+
product.recurring_task = True
1273+
product.service_tracking = "task_global_project"
1274+
product._onchange_service_tracking()
1275+
self.assertTrue(product.recurring_task)
1276+
1277+
# Test disabling service tracking
1278+
product.service_tracking = "no"
1279+
product._onchange_service_tracking()
1280+
self.assertFalse(product.recurring_task)
1281+
1282+
# Test re-enabling service tracking
1283+
# Note: It should not automatically re-enable recurring_task
1284+
product.service_tracking = "task_global_project"
1285+
product._onchange_service_tracking()
1286+
self.assertFalse(product.recurring_task)

0 commit comments

Comments
 (0)