-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[17.0][FIX] maintenance_timesheet: missing report
- Loading branch information
1 parent
dee55f0
commit 225d064
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import models | ||
from . import reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import timesheets_analysis_report |
36 changes: 36 additions & 0 deletions
36
maintenance_timesheet/report/timesheets_analysis_report.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
""" | ||
) |