From 4b37c669377961c1f3a117664c246a6806ac1ffe Mon Sep 17 00:00:00 2001 From: Juanjo Date: Thu, 1 Aug 2024 18:00:28 +0200 Subject: [PATCH] [MIG] hr_attendance_report_theoretical_time: Migration to 17.0 --- .../README.rst | 1 + .../__manifest__.py | 2 +- .../models/hr_attendance.py | 9 ++++++ .../readme/CONTRIBUTORS.md | 1 + .../reports/__init__.py | 1 - .../reports/hr_attendance_report.py | 18 ----------- .../reports/hr_attendance_report_views.xml | 4 +-- .../hr_attendance_theoretical_time_report.py | 2 +- ...tendance_theoretical_time_report_views.xml | 30 +++++++++++-------- ...dance_report_theoretical_time_security.xml | 7 +++-- .../security/ir.model.access.csv | 4 +-- .../static/description/index.html | 1 + ...t_hr_attendance_report_theoretical_time.py | 16 ++-------- .../views/hr_employee_views.xml | 2 +- .../wizards/wizard_theoretical_time.xml | 2 +- 15 files changed, 45 insertions(+), 55 deletions(-) delete mode 100644 hr_attendance_report_theoretical_time/reports/hr_attendance_report.py diff --git a/hr_attendance_report_theoretical_time/README.rst b/hr_attendance_report_theoretical_time/README.rst index 1cd56cc2..094c4f99 100644 --- a/hr_attendance_report_theoretical_time/README.rst +++ b/hr_attendance_report_theoretical_time/README.rst @@ -149,6 +149,7 @@ Contributors - Pedro M. Baeza. - David Vidal - Víctor Martínez + - Juan José Seguí - Pedro Gonzalez - Aritz Olea diff --git a/hr_attendance_report_theoretical_time/__manifest__.py b/hr_attendance_report_theoretical_time/__manifest__.py index edeca2df..17fb7bd1 100644 --- a/hr_attendance_report_theoretical_time/__manifest__.py +++ b/hr_attendance_report_theoretical_time/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Theoretical vs Attended Time Analysis", - "version": "16.0.1.1.0", + "version": "17.0.1.0.0", "category": "Human Resources", "website": "https://github.com/OCA/hr-attendance", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/hr_attendance_report_theoretical_time/models/hr_attendance.py b/hr_attendance_report_theoretical_time/models/hr_attendance.py index 8bdf9fb3..31f8861c 100644 --- a/hr_attendance_report_theoretical_time/models/hr_attendance.py +++ b/hr_attendance_report_theoretical_time/models/hr_attendance.py @@ -18,3 +18,12 @@ def _compute_theoretical_hours(self): record.theoretical_hours = obj._theoretical_hours( record.employee_id, record.check_in ) + + @api.model + def _select(self): + return super()._select() + """, hra.theoretical_hours""" + + @api.model + def _from(self): + res = super()._from() + return res.replace("worked_hours", "worked_hours, theoretical_hours") diff --git a/hr_attendance_report_theoretical_time/readme/CONTRIBUTORS.md b/hr_attendance_report_theoretical_time/readme/CONTRIBUTORS.md index cc058652..3cb73665 100644 --- a/hr_attendance_report_theoretical_time/readme/CONTRIBUTORS.md +++ b/hr_attendance_report_theoretical_time/readme/CONTRIBUTORS.md @@ -2,6 +2,7 @@ - Pedro M. Baeza. - David Vidal - Víctor Martínez + - Juan José Seguí - Pedro Gonzalez \<\> - Aritz Olea \<\> - [Trobz](https://trobz.com): diff --git a/hr_attendance_report_theoretical_time/reports/__init__.py b/hr_attendance_report_theoretical_time/reports/__init__.py index 62fd7d71..ca76ed84 100644 --- a/hr_attendance_report_theoretical_time/reports/__init__.py +++ b/hr_attendance_report_theoretical_time/reports/__init__.py @@ -1,4 +1,3 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from . import hr_attendance_report from . import hr_attendance_theoretical_time_report diff --git a/hr_attendance_report_theoretical_time/reports/hr_attendance_report.py b/hr_attendance_report_theoretical_time/reports/hr_attendance_report.py deleted file mode 100644 index 401d0283..00000000 --- a/hr_attendance_report_theoretical_time/reports/hr_attendance_report.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2022 Tecnativa - Víctor Martínez -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import api, fields, models - - -class HRAttendanceReport(models.Model): - _inherit = "hr.attendance.report" - - theoretical_hours = fields.Float(readonly=True) - - @api.model - def _select(self): - return super()._select() + """, hra.theoretical_hours""" - - @api.model - def _from(self): - res = super()._from() - return res.replace("worked_hours", "worked_hours, theoretical_hours") diff --git a/hr_attendance_report_theoretical_time/reports/hr_attendance_report_views.xml b/hr_attendance_report_theoretical_time/reports/hr_attendance_report_views.xml index 3d15a778..dd64c64c 100644 --- a/hr_attendance_report_theoretical_time/reports/hr_attendance_report_views.xml +++ b/hr_attendance_report_theoretical_time/reports/hr_attendance_report_views.xml @@ -6,8 +6,8 @@ hr.attendance.pivot - Don't show "Theoretical hours" measure - hr.attendance.report - + hr.attendance + diff --git a/hr_attendance_report_theoretical_time/reports/hr_attendance_theoretical_time_report.py b/hr_attendance_report_theoretical_time/reports/hr_attendance_theoretical_time_report.py index 34b3a1b3..b0d8e8ab 100644 --- a/hr_attendance_report_theoretical_time/reports/hr_attendance_theoretical_time_report.py +++ b/hr_attendance_report_theoretical_time/reports/hr_attendance_theoretical_time_report.py @@ -206,7 +206,7 @@ def read_group( This technique has proven to be more efficient than trying to call recursively `read_group` grouping by date and employee. """ - res = super(HrAttendanceTheoreticalTimeReport, self).read_group( + res = super().read_group( domain, fields, groupby, diff --git a/hr_attendance_report_theoretical_time/reports/hr_attendance_theoretical_time_report_views.xml b/hr_attendance_report_theoretical_time/reports/hr_attendance_theoretical_time_report_views.xml index 4c28e67f..6b53b661 100644 --- a/hr_attendance_report_theoretical_time/reports/hr_attendance_theoretical_time_report_views.xml +++ b/hr_attendance_report_theoretical_time/reports/hr_attendance_theoretical_time_report_views.xml @@ -39,7 +39,7 @@ hr.attendance.theoretical.time.report - + @@ -67,11 +67,15 @@ name="context" >{'search_default_previous_month': 1, 'search_default_current_month': 1, 'search_default_my': 1} pivot,graph + - +