From d58febb2c2cc83fb6e4972cd3b039d93bbb5f6e2 Mon Sep 17 00:00:00 2001 From: FernandoRomera Date: Fri, 13 Sep 2024 10:15:32 +0200 Subject: [PATCH] [17.0][FIX] maintenance_timesheet: missing report --- maintenance_timesheet/__init__.py | 1 + maintenance_timesheet/report/__init__.py | 1 + .../report/timesheets_analysis_report.py | 27 +++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 maintenance_timesheet/report/__init__.py create mode 100644 maintenance_timesheet/report/timesheets_analysis_report.py diff --git a/maintenance_timesheet/__init__.py b/maintenance_timesheet/__init__.py index 0650744f6..bf588bc8b 100644 --- a/maintenance_timesheet/__init__.py +++ b/maintenance_timesheet/__init__.py @@ -1 +1,2 @@ from . import models +from . import report diff --git a/maintenance_timesheet/report/__init__.py b/maintenance_timesheet/report/__init__.py new file mode 100644 index 000000000..0cb32374b --- /dev/null +++ b/maintenance_timesheet/report/__init__.py @@ -0,0 +1 @@ +from . import timesheets_analysis_report diff --git a/maintenance_timesheet/report/timesheets_analysis_report.py b/maintenance_timesheet/report/timesheets_analysis_report.py new file mode 100644 index 000000000..fbbdc4ded --- /dev/null +++ b/maintenance_timesheet/report/timesheets_analysis_report.py @@ -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 + """ + )