Theoretical vs Attended Time Analysis
hr_attendance_report_theoretical_time · OCA/hr-attendance
OCA/hr 10.0–12.0 → OCA/hr-attendance 13.0–19.0
-
Security25/25No findings
-
Activity25/25Last human commit 2 months ago
-
Required by5/250 modules depend on it
-
Maturity25/25In 10 Odoo series since 10.0
Heuristic over the facts below, not an audit · How it's computed
Migration considerations
- Raw `cr.execute()` INSERT/UPDATE/DELETE bypasses the ORM (no compute/constrains/tracking/mail): `UPDATE hr_attendance SET leave_hours = 0` - re-check the table/column names still match after upgrading. (2 occurrences in this file) migration-raw-sql-write · source
hr.attendance.theoretical.time.report— Model 'hr.attendance.theoretical.time.report' has `_auto = False` and its init() (re)creates a SQL VIEW: the standard reporting-model pattern, but its raw SQL isn't checked by the ORM - verify it against renamed/removed tables and columns in the target version. migration-sql-view
Migration review checklist, not a compatibility verdict. "Migrating to X.0" applies once you upgrade to that version; "Since X.0" means this version already ignores or rejects that code. Methodology
Description
This module adds a new report called "Theoretical vs Attended Time Analysis" that compares worked time, measured through attendances records, with the theoretical time, computed from employee's working calendar, public holidays and employee specific leaves. Missing attendance days are generated on the fly in the report with their corresponding theoretical hours.
There is the possibility of counting as theoretical time some leave types if specified in them.
As an example, imagine a work week with 40 theoretical hours, and these attendance situation:
- Monday: Worked 10 hours
- Tuesday: Worked 10 hours
- Wednesday: Worked 10 hours
- Thursday: Worked 10 hours
- Friday: Ask for a compensation leave (said leave type), as already worked 40 hours.
On the report, whole week should put 40 theoretical hours - 8 per day - against 40 worked hours (although they were on previous days, and none on Friday).
On contrary, if you want to take a holiday one of that days, you should ask for a leave type without the check for counting as theoretical time, and then the whole week will be 32 theoretical hours against the worked hours of that week without the leave.
Dependencies
Code analysis
Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.
Views touched 8
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
edit_holiday_status_form |
hr.leave.type | form | Inherits hr_holidays.edit_holiday_status_form | |
hr_attendance_theoretical_view_filter |
hr.attendance.theoretical.time.report | search | New | |
hr_attendance_theoretical_view_graph |
hr.attendance.theoretical.time.report | graph | New | |
hr_attendance_theoretical_view_pivot |
hr.attendance.theoretical.time.report | pivot | New | |
hr_attendance_view_pivot |
hr.attendance.pivot - Don't show "Theoretical hours" measure | hr.attendance | pivot | Inherits hr_attendance.hr_attendance_view_pivot |
recompute_theoretical_attendance_form |
recompute.theoretical.attendance | form | New | |
view_employee_form_inherit_hr_attendance |
hr.employee | form | Inherits hr.view_employee_form | |
wizard_theoretical_time_form_view |
wizard.theoretical.time.form (in hr_attendance_report_theoretical_time) | wizard.theoretical.time | form | New |
HTTP endpoints 0
No HTTP endpoints found for this module.
Models touched 10
No new fields.
Public methods (2)-
create(self, vals_list)@api.model_create_multiTrigger recomputation for the date of the new lines. -
write(self, vals)If the date of a line is changed, we first recompute hours of the previous date, and then the theoretical hours of the current date.
-
activeBooleandefault=True -
leave_hoursFloatcompute='_compute_leave_hours'compute_sudo=Truestore=True -
theoretical_hoursFloatcompute='_compute_theoretical_hours'compute_sudo=Truestore=True
-
action_create_empty_attendance(self, limit_date_from=False, limit_date_to=False)Method for creating inactive attendance records with a duration of 0. The goal is to prevent the report from having to calculate data directly, so employee attendance records are created for past days when they should have clocked in.
-
company_idMany2onerelated='employee_id.company_id' -
dateDatereadonly=True -
department_idMany2one → hr.departmentcomodel_name='hr.department'readonly=Truerelated='employee_id.department_id'string='Department' -
differenceFloatreadonly=True -
employee_idMany2one → hr.employeecomodel_name='hr.employee'readonly=Truestring='Employee' -
leave_hoursFloatreadonly=Truestring='Leave' -
theoretical_hoursFloatreadonly=Truestring='Theoric' -
worked_hoursFloatreadonly=Truestring='Worked'
-
init(self)
-
theoretical_hours_start_dateDatehelp='Fill this field for setting a manual start date for computing the theoretical hours independently from the attendances. If not filled, employee creation date or the calendar start date will be used (the greatest of both).'
-
write(self, vals)
-
theoretical_hours_start_dateDatehelp='Fill this field for setting a manual start date for computing the theoretical hours independently from the attendances. If not filled, employee creation date or the calendar start date will be used (the greatest of both).'
No public methods.
No new fields.
Public methods (0)No public methods.
-
include_in_leave_theoreticalBooleanhelp="If you check this mark, leaves in this category won't reduce the number of leave hours in the attendance report."string='Include in leave hours' -
include_in_theoreticalBooleanhelp="If you check this mark, leaves in this category won't reduce the number of theoretical hours in the attendance report."string='Include in theoretical hours'
No public methods.
-
date_fromDatetimehelp='Recompute attendances from this date'required=Truestring='From' -
date_toDatetimehelp='Recompute attendances up to this date'required=Truestring='To' -
employee_idsMany2many → hr.employeecomodel_name='hr.employee'context={'active_test': False}help='Recompute these employees attendances'required=Truestring='Employees'
-
action_recompute(self)
No new fields.
Public methods (0)No public methods.
-
category_idsMany2many → hr.employee.categorycomodel_name='hr.employee.category'string='Tag' -
department_idMany2one → hr.departmentcomodel_name='hr.department'string='Department' -
employee_idsMany2many → hr.employeecomodel_name='hr.employee'string='Employees'
-
default_get(self, fields)@api.model -
populate(self) -
view_report(self)
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…