Skip to content

Commit 8cfd052

Browse files
[MIG] maintenance_project: Migration to 18.0
1 parent b543749 commit 8cfd052

File tree

13 files changed

+51
-112
lines changed

13 files changed

+51
-112
lines changed

maintenance_project/README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Maintenance Projects
77
!! This file is generated by oca-gen-addon-readme !!
88
!! changes will be overwritten. !!
99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:d68a0f7d567eafa344eb212be0520f6c37c4dccc3ec106ebad8884fa57af3fa9
10+
!! source digest: sha256:473d5c602dfbc7e5289ff2bcc222bee45ec00cc1647ce8ada1961803e90c77aa
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
1313
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -68,6 +68,9 @@ Contributors
6868
------------
6969

7070
- David Alonso <[email protected]>
71+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
72+
73+
- Bhavesh Heliconia
7174

7275
Maintainers
7376
-----------

maintenance_project/__manifest__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
{
44
"name": "Maintenance Projects",
55
"summary": "Adds projects to maintenance equipments and requests",
6-
"version": "16.0.2.0.0",
6+
"version": "18.0.1.0.0",
77
"author": "Odoo Community Association (OCA), Solvos",
88
"license": "AGPL-3",
99
"category": "Maintenance",
1010
"website": "https://github.com/OCA/maintenance",
1111
"depends": ["base_maintenance", "project"],
1212
"data": [
13-
"views/maintenance_equipment_views.xml",
1413
"views/maintenance_request_views.xml",
1514
"views/project_project_views.xml",
1615
"report/maintenance_request_report.xml",
1716
],
18-
"demo": ["data/demo_maintenance_project.xml"],
17+
"demo": ["demo/demo_maintenance_project.xml"],
1918
"installable": True,
2019
}

maintenance_project/data/demo_maintenance_project.xml renamed to maintenance_project/demo/demo_maintenance_project.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
<field name="serial_no">S/N 2</field>
3737
<field name="model">MODEL2</field>
3838
<field name="project_id" ref="maintenance_project.project_project_1" />
39-
<field name="period" eval="30" />
40-
<field name="maintenance_duration" eval="2" />
4139
<field
4240
name="preventive_default_task_id"
4341
ref="maintenance_project.project_task_12"

maintenance_project/i18n/maintenance_project.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 16.0\n"
7+
"Project-Id-Version: Odoo Server 17.0\n"
88
"Report-Msgid-Bugs-To: \n"
99
"Last-Translator: \n"
1010
"Language-Team: \n"

maintenance_project/migrations/16.0.2.0.0/post-migration.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

maintenance_project/models/maintenance_request.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,5 @@ def create(self, vals_list):
2727

2828
@api.onchange("equipment_id")
2929
def onchange_equipment_id(self):
30-
res = super().onchange_equipment_id()
3130
if self.equipment_id and self.equipment_id.project_id:
3231
self.project_id = self.equipment_id.project_id
33-
return res
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
- David Alonso \<<[email protected]>\>
2+
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
3+
- Bhavesh Heliconia
4+

maintenance_project/report/maintenance_request_report.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
>
77
<xpath expr="//div[@id='schedule_informations']" position="after">
88
<div class="row mt32 mb32" id="project_informations">
9-
<div t-if="doc.project_id" class="col-auto mw-100 mb-2">
9+
<div t-if="doc.project_id" class="col-3">
1010
<strong>Project:</strong>
1111
<p class="m-0" t-field="doc.project_id" />
1212
</div>
13-
<div t-if="doc.task_id" class="col-auto mw-100 mb-2">
13+
<div t-if="doc.task_id" class="col-3">
1414
<strong>Task:</strong>
1515
<p class="m-0" t-field="doc.task_id" />
1616
</div>

maintenance_project/static/description/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ <h1 class="title">Maintenance Projects</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370-
!! source digest: sha256:d68a0f7d567eafa344eb212be0520f6c37c4dccc3ec106ebad8884fa57af3fa9
370+
!! source digest: sha256:473d5c602dfbc7e5289ff2bcc222bee45ec00cc1647ce8ada1961803e90c77aa
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372372
<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/maintenance/tree/18.0/maintenance_project"><img alt="OCA/maintenance" src="https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/maintenance-18-0/maintenance-18-0-maintenance_project"><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/maintenance&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 extends the functionality of Odoo Maintenance module adding
@@ -414,6 +414,10 @@ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
414414
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
415415
<ul class="simple">
416416
<li>David Alonso &lt;<a class="reference external" href="mailto:david.alonso&#64;solvos.es">david.alonso&#64;solvos.es</a>&gt;</li>
417+
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
418+
<li>Bhavesh Heliconia</li>
419+
</ul>
420+
</li>
417421
</ul>
418422
</div>
419423
<div class="section" id="maintainers">

maintenance_project/tests/test_maintenance_project.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class TestMaintenanceProject(BaseCommon):
1212
@classmethod
1313
def setUpClass(cls):
1414
super().setUpClass()
15-
cls.cron = cls.env.ref("maintenance.maintenance_requests_cron")
1615
cls.project1 = cls.env["project.project"].create({"name": "My project"})
1716
cls.project_demo = cls.env.ref("maintenance_project.project_project_1")
1817
new_test_user(
@@ -31,8 +30,6 @@ def setUpClass(cls):
3130
"maintenance_team_id": cls.env.ref(
3231
"maintenance.equipment_team_metrology"
3332
).id,
34-
"period": 30,
35-
"maintenance_duration": 1.0,
3633
}
3734
)
3835
cls.equipment2 = cls.env["maintenance.equipment"].create(
@@ -95,14 +92,34 @@ def test_request_equipment(self):
9592
self.assertFalse(request_form_2.project_id)
9693

9794
def test_generate_requests(self):
98-
self.cron.method_direct_trigger()
99-
generated_requests = self.env["maintenance.request"].search(
100-
[("project_id", "!=", False)]
95+
req_name = "My new recurring test request"
96+
req = self.env["maintenance.request"].create(
97+
{
98+
"name": req_name,
99+
"maintenance_type": "preventive",
100+
"duration": 1.0,
101+
"recurring_maintenance": True,
102+
"repeat_interval": 1,
103+
"repeat_unit": "month",
104+
"repeat_type": "forever",
105+
}
101106
)
102-
for req in generated_requests:
103-
self.assertEqual(req.project_id, req.equipment_id.project_id)
104-
self.assertEqual(req.task_id, req.equipment_id.preventive_default_task_id)
105-
self.assertEqual(req.project_id.maintenance_request_count, 1)
107+
req.equipment_id = self.equipment1
108+
req.onchange_equipment_id()
109+
req.description = "Request done!"
110+
111+
request_obj = self.env["maintenance.request"]
112+
domain = [
113+
("name", "=", req_name),
114+
("equipment_id", "=", self.equipment1.id),
115+
("project_id", "=", self.equipment1.project_id.id),
116+
]
117+
my_requests = request_obj.search(domain)
118+
self.assertEqual(len(my_requests), 1)
119+
120+
req.stage_id = self.env.ref("maintenance.stage_3")
121+
my_requests = request_obj.search(domain)
122+
self.assertEqual(len(my_requests), 2)
106123

107124
def test_project_action_views(self):
108125
act1 = self.project1.action_view_equipment_ids()

0 commit comments

Comments
 (0)