Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG]hr_attendance_hour_type_report #203

Open
wants to merge 19 commits into
base: 16.0
Choose a base branch
from

Conversation

adasatorres
Copy link

Good morning, a new feature has been added for migration. It allows overtime hours to be displayed in the report and also enables the weighting of nighttime and overtime hours.

To enable the visibility of overtime hours, you need to activate overtime in the settings. Additionally, there are options in the settings to enable weightings.

gurneyalex and others added 18 commits December 27, 2024 12:28
This module provides a new report in hr_attendance to display the worked
time of employees split in the following categories:

* type of day (weekday, sunday, holiday)
* daytime / nighttime

The information of a day being a holiday comes from the configured
public holidays from the module hr_holidays_public.

This is meant as a helper for people interacting with external payroll systems.
Currently translated at 23.0% (6 of 26 strings)

Translation: hr-attendance-14.0/hr-attendance-14.0-hr_attendance_hour_type_report
Translate-URL: https://translation.odoo-community.org/projects/hr-attendance-14-0/hr-attendance-14-0-hr_attendance_hour_type_report/fr/
Currently translated at 80.7% (21 of 26 strings)

Translation: hr-attendance-14.0/hr-attendance-14.0-hr_attendance_hour_type_report
Translate-URL: https://translation.odoo-community.org/projects/hr-attendance-14-0/hr-attendance-14-0-hr_attendance_hour_type_report/fr/
Currently translated at 100.0% (26 of 26 strings)

Translation: hr-attendance-14.0/hr-attendance-14.0-hr_attendance_hour_type_report
Translate-URL: https://translation.odoo-community.org/projects/hr-attendance-14-0/hr-attendance-14-0-hr_attendance_hour_type_report/it/
Currently translated at 100.0% (26 of 26 strings)

Translation: hr-attendance-14.0/hr-attendance-14.0-hr_attendance_hour_type_report
Translate-URL: https://translation.odoo-community.org/projects/hr-attendance-14-0/hr-attendance-14-0-hr_attendance_hour_type_report/it/
Currently translated at 15.3% (4 of 26 strings)

Translation: hr-attendance-14.0/hr-attendance-14.0-hr_attendance_hour_type_report
Translate-URL: https://translation.odoo-community.org/projects/hr-attendance-14-0/hr-attendance-14-0-hr_attendance_hour_type_report/es/
Currently translated at 100.0% (26 of 26 strings)

Translation: hr-attendance-14.0/hr-attendance-14.0-hr_attendance_hour_type_report
Translate-URL: https://translation.odoo-community.org/projects/hr-attendance-14-0/hr-attendance-14-0-hr_attendance_hour_type_report/es/
@adasatorres adasatorres force-pushed the 16.0-mig-hr_attendance_hour_type_report branch 2 times, most recently from b45ee85 to 8c48e70 Compare December 30, 2024 10:15
@lauradiaz22
Copy link

@adasatorres Good morning,
During functional review I have found that the night schedule that is set within the attendance configuration, does not pick up the hours correctly. If I establish that the night schedule is from 22.00pm to 6.00am effectively if a worker makes this schedule he/she would have 8 night hours. However, the program shows me 7 night hours and 1 day hour, it does not show all the hours that are set as night hours. In addition, I have made several examples and it always counts one less.

Thank you very much in advance.

@adasatorres adasatorres force-pushed the 16.0-mig-hr_attendance_hour_type_report branch from 8c48e70 to 0dc9c7a Compare December 31, 2024 11:59
Copy link

@lauradiaz22 lauradiaz22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good morning,

I have done a functional review and this LGTM👍. But it should be noted that this error is also found in the version 14.

Copy link

@rrebollo rrebollo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: LGTM!
This is a dense and impressive addon—congratulations on the effort you've put into it. Timezone manipulation can be a tricky topic, and I really appreciate the way you've handled it here. I've made a few suggestions that might help improve readability and robustness. Feel free to consider them if you find them useful!

Comment on lines +98 to +104
TZ = pytz.timezone(rec.employee_id.tz)
tz = rec.employee_id.tz
check_in = rec.check_in
if not check_in.tzinfo:
check_in = TZ.localize(check_in)
check_in_tz = check_in.astimezone(pytz.timezone(tz))
rec.date = check_in_tz.date()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TZ = pytz.timezone(rec.employee_id.tz)
tz = rec.employee_id.tz
check_in = rec.check_in
if not check_in.tzinfo:
check_in = TZ.localize(check_in)
check_in_tz = check_in.astimezone(pytz.timezone(tz))
rec.date = check_in_tz.date()
tz_code = rec.employee_id.tz
TZ = pytz.timezone(tz_code)
check_in = rec.check_in
if not check_in.tzinfo:
check_in = TZ.localize(check_in)
check_in_tz = check_in.astimezone(TZ)
rec.date = check_in_tz.date()

Just some refactoring.

night_end = rec.employee_id.company_id.hr_night_work_hour_end
hour_night_end = int(night_end)
minute_night_end = int(60 * (night_end - hour_night_end))
tz = pytz.timezone(rec.employee_id.tz)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same from line 111

<field name="model">hr.attendance</field>
<field name="priority">30</field>
<field name="arch" type="xml">
<tree export_xlsx="1">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<tree export_xlsx="1">
<tree>

export_xlsx="1" is default behavior

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants