Skip to content

Commit

Permalink
[MIG] maintenance_timesheet: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Feb 7, 2025
1 parent 049f111 commit bcd612d
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 23 deletions.
5 changes: 4 additions & 1 deletion maintenance_timesheet/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Maintenance Timesheets
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:805455b905e0bb2c77b9c388b459914983fb8f17bcd86925fa9aae75870a5d7a
!! source digest: sha256:1b98f2753800236b54b8f2dfa33853e253e7a69f8b58578bf7b6cf99bfd9562d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -59,6 +59,9 @@ Contributors
- David Alonso <[email protected]>
- Luisa Miguéns <[email protected]>
- Christian Ramos <[email protected]>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

Maintainers
-----------
Expand Down
1 change: 1 addition & 0 deletions maintenance_timesheet/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from . import report
6 changes: 3 additions & 3 deletions maintenance_timesheet/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"summary": "Adds timesheets to maintenance requests",
"author": "Odoo Community Association (OCA), Solvos",
"license": "AGPL-3",
"version": "16.0.2.0.0",
"version": "18.0.1.0.0",
"category": "Human Resources",
"website": "https://github.com/OCA/maintenance",
"depends": ["base_maintenance", "maintenance_project", "hr_timesheet"],
"depends": ["maintenance_project", "hr_timesheet"],
"data": [
"security/maintenance_timesheet_security.xml",
"views/hr_timesheet_views.xml",
"views/maintenance_request_views.xml",
"report/maintenance_request_report.xml",
],
"demo": ["data/demo_maintenance_timesheet.xml"],
"demo": ["demo/demo_maintenance_timesheet.xml"],
"installable": True,
}
6 changes: 6 additions & 0 deletions maintenance_timesheet/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ msgstr "Equipo"
#. module: maintenance_timesheet
#: model:ir.model,name:maintenance_timesheet.model_maintenance_request
#: model:ir.model.fields,field_description:maintenance_timesheet.field_account_analytic_line__maintenance_request_id
#: model:ir.model.fields,field_description:maintenance_timesheet.field_timesheets_analysis_report__maintenance_request_id
msgid "Maintenance Request"
msgstr "Petición de mantenimiento"

Expand Down Expand Up @@ -142,6 +143,11 @@ msgstr "Horas totales en partes de trabajo"
msgid "Timesheets"
msgstr "Partes de trabajo"

#. module: maintenance_timesheet
#: model:ir.model,name:maintenance_timesheet.model_timesheets_analysis_report
msgid "Timesheets Analysis Report"
msgstr ""

#~ msgid "<span class=\"o_label\" >Hours</span>"
#~ msgstr "<span class=\"o_label\" >horas</span>"

Expand Down
10 changes: 8 additions & 2 deletions maintenance_timesheet/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-14 15:36+0000\n"
"PO-Revision-Date: 2025-01-11 12:06+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"X-Generator: Weblate 5.6.2\n"

#. module: maintenance_timesheet
#: model_terms:ir.ui.view,arch_db:maintenance_timesheet.hr_equipment_request_view_kanban
Expand Down Expand Up @@ -86,6 +86,7 @@ msgstr "Attrezzatura manutenzione"
#. module: maintenance_timesheet
#: model:ir.model,name:maintenance_timesheet.model_maintenance_request
#: model:ir.model.fields,field_description:maintenance_timesheet.field_account_analytic_line__maintenance_request_id
#: model:ir.model.fields,field_description:maintenance_timesheet.field_timesheets_analysis_report__maintenance_request_id
msgid "Maintenance Request"
msgstr "Richiesta manutenzione"

Expand Down Expand Up @@ -141,6 +142,11 @@ msgstr "Ore totali foglio presenze"
msgid "Timesheets"
msgstr "Fogli ore"

#. module: maintenance_timesheet
#: model:ir.model,name:maintenance_timesheet.model_timesheets_analysis_report
msgid "Timesheets Analysis Report"
msgstr "Resoconto analisi foglii ore"

#~ msgid "<span class=\"o_label\" style=\"padding-left: 5px;\">Hours</span>"
#~ msgstr "<span class=\"o_label\" style=\"padding-left: 5px;\">Ore</span>"

Expand Down
8 changes: 7 additions & 1 deletion maintenance_timesheet/i18n/maintenance_timesheet.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -77,6 +77,7 @@ msgstr ""
#. module: maintenance_timesheet
#: model:ir.model,name:maintenance_timesheet.model_maintenance_request
#: model:ir.model.fields,field_description:maintenance_timesheet.field_account_analytic_line__maintenance_request_id
#: model:ir.model.fields,field_description:maintenance_timesheet.field_timesheets_analysis_report__maintenance_request_id
msgid "Maintenance Request"
msgstr ""

Expand Down Expand Up @@ -131,3 +132,8 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:maintenance_timesheet.equipment_request_view_form
msgid "Timesheets"
msgstr ""

#. module: maintenance_timesheet
#: model:ir.model,name:maintenance_timesheet.model_timesheets_analysis_report
msgid "Timesheets Analysis Report"
msgstr ""
4 changes: 2 additions & 2 deletions maintenance_timesheet/models/hr_timesheet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# © 2019 Solvos Consultoría Informática (<http://www.solvos.es>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import ValidationError


Expand Down Expand Up @@ -50,7 +50,7 @@ def _check_request_done(self, request_id: int | list[int]):
self.env["maintenance.request"].browse(request_ids).stage_id.mapped("done")
):
raise ValidationError(
_(
self.env._(
"Cannot save or delete a timesheet for "
"a maintenance request already done"
)
Expand Down
2 changes: 1 addition & 1 deletion maintenance_timesheet/models/maintenance_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MaintenanceRequest(models.Model):
planned_hours = fields.Float(tracking=True)
progress = fields.Float(
compute="_compute_progress_hours",
group_operator="avg",
aggregator="avg",
store=True,
)
remaining_hours = fields.Float(
Expand Down
3 changes: 3 additions & 0 deletions maintenance_timesheet/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- David Alonso \<<[email protected]>\>
- Luisa Miguéns \<<[email protected]>\>
- Christian Ramos \<<[email protected]>\>
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
- Bhavesh Heliconia

1 change: 1 addition & 0 deletions maintenance_timesheet/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import timesheets_analysis_report
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</td>
<td class="text-right">
<strong
t-esc="sum(doc.timesheet_ids.mapped('unit_amount'))"
t-out="sum(doc.timesheet_ids.mapped('unit_amount'))"
t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"
/>
</td>
Expand Down
27 changes: 27 additions & 0 deletions maintenance_timesheet/report/timesheets_analysis_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from odoo import api, fields, models


class TimesheetsAnalysisReport(models.Model):
_inherit = "timesheets.analysis.report"

maintenance_request_id = fields.Many2one(
comodel_name="maintenance.request", readonly=True
)

@api.model
def _select(self):
return (
super()._select()
+ """,
A.maintenance_request_id AS maintenance_request_id
"""
)

@api.model
def _from(self):
return (
super()._from()
+ """
LEFT JOIN maintenance_request MR ON A.maintenance_request_id = MR.id
"""
)
6 changes: 5 additions & 1 deletion maintenance_timesheet/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Maintenance Timesheets</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:805455b905e0bb2c77b9c388b459914983fb8f17bcd86925fa9aae75870a5d7a
!! source digest: sha256:1b98f2753800236b54b8f2dfa33853e253e7a69f8b58578bf7b6cf99bfd9562d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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_timesheet"><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_timesheet"><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>
<p>This module adds timesheets to a request.</p>
Expand Down Expand Up @@ -405,6 +405,10 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<li>David Alonso &lt;<a class="reference external" href="mailto:david.alonso&#64;solvos.es">david.alonso&#64;solvos.es</a>&gt;</li>
<li>Luisa Miguéns &lt;<a class="reference external" href="mailto:luisa.miguens&#64;solvos.es">luisa.miguens&#64;solvos.es</a>&gt;</li>
<li>Christian Ramos &lt;<a class="reference external" href="mailto:c.ramos&#64;binhex.es">c.ramos&#64;binhex.es</a>&gt;</li>
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
<li>Bhavesh Heliconia</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
21 changes: 10 additions & 11 deletions maintenance_timesheet/views/maintenance_request_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
model="ir.actions.act_window.view"
>
<field name="sequence" eval="5" />
<field name="view_mode">tree</field>
<field name="view_mode">list</field>
<field name="view_id" ref="hr_timesheet.timesheet_view_tree_user" />
<field name="act_window_id" ref="timesheet_action_from_request" />
</record>
Expand Down Expand Up @@ -44,13 +44,13 @@
<field name="model">maintenance.request</field>
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_kanban" />
<field name="arch" type="xml">
<xpath expr="//field[@name='activity_state']" position="after">
<xpath expr="//field[@name='archive']" position="before">
<field
name="timesheet_total_hours"
groups="hr_timesheet.group_hr_timesheet_user"
/>
</xpath>
<xpath expr="//div[hasclass('oe_kanban_bottom_left')]" position="inside">
<xpath expr="//footer//field[@name='activity_ids']" position="after">
<a
class="o_project_kanban_box"
name="action_view_timesheet_ids"
Expand All @@ -64,9 +64,8 @@
class="oe_inline"
widget="timesheet_uom"
/>
<!-- t t-esc="record.timesheet_total_hours.value"/-->
</span>
<span class="o_label">Hours</span>
<span class="oe_label">Hours</span>
</div>
</a>
</xpath>
Expand Down Expand Up @@ -107,7 +106,7 @@
<page
string="Timesheets"
name="timesheets"
attrs="{'invisible':[('project_id', '=', False)]}"
invisible="not project_id"
groups="hr_timesheet.group_hr_timesheet_user"
>
<group>
Expand All @@ -122,10 +121,10 @@
name="timesheet_ids"
context="{'default_project_id': project_id, 'default_task_id': task_id}"
>
<tree editable="bottom" delete="true">
<field name="company_id" invisible="1" />
<field name="project_id" invisible="1" />
<field name="task_id" invisible="1" />
<list editable="bottom" delete="true">
<field name="company_id" column_invisible="True" />
<field name="project_id" column_invisible="True" />
<field name="task_id" column_invisible="True" />
<field name="date" widget="date" />
<field name="user_id" required="1" />
<field name="name" />
Expand All @@ -134,7 +133,7 @@
string="Duration (Hour(s))"
widget="float_time"
/>
</tree>
</list>
<form>
<group>
<field name="date" />
Expand Down

0 comments on commit bcd612d

Please sign in to comment.