Skip to content

Commit

Permalink
[17.0][FIX] maintenance_timesheet: missing report
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoRomera committed Sep 13, 2024
1 parent dee55f0 commit f9100ab
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
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
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
39 changes: 39 additions & 0 deletions maintenance_timesheet/report/timesheets_analysis_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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
)

@property
def _table_query(self):
query_select = self._select()
query_from = self._from()
query_where = self._where()
return f"""
SELECT A.*
FROM (
{query_select} {query_from} {query_where}
) A
"""

@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
"""
)

0 comments on commit f9100ab

Please sign in to comment.