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 b9ffc13
Show file tree
Hide file tree
Showing 3 changed files with 38 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 reports
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
36 changes: 36 additions & 0 deletions maintenance_timesheet/report/timesheets_analysis_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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):
return """
SELECT A.*
FROM (
%s %s %s
) A
""" % (self._select(), self._from(), self._where())

@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 b9ffc13

Please sign in to comment.