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

create_missing_attendances scheitert bei Anwesenheiten über Mitternacht #88

Closed
albig opened this issue Dec 22, 2023 · 3 comments · Fixed by #89
Closed

create_missing_attendances scheitert bei Anwesenheiten über Mitternacht #88

albig opened this issue Dec 22, 2023 · 3 comments · Fixed by #89
Assignees
Labels
bug Something isn't working Prio 1

Comments

@albig
Copy link
Member

albig commented Dec 22, 2023

Wenn eine Anwesenheiten über Mitternacht geht, scheitert der Cronjob create_missing_attendances mit dem Hinweis, dass der Mitarbeitende bereits eingecheckt ist. Alle weiteren Einträge werden nicht mehr bearbeitet.

2023-12-22_16-41
2023-12-22_16-41_1

2023-12-22 02:00:45,175 514625 ERROR lv-bb odoo.addons.base.models.ir_cron: Call from cron Missing Attendance for server action #302 failed in Job #18
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_cron.py", line 372, in _callback
self.env['ir.actions.server'].browse(server_action_id).run()
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions.py", line 643, in run
res = runner(run_self, eval_context=eval_context)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions.py", line 512, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True)  # nocopy allows to return 'action'
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 332, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in <module>
File "/srv/odoo/extra-addons/hr_attendance_missing_days/models/hr_employee.py", line 38, in create_missing_attendances
emp._create_missing_attendances(date_from, date_to)
File "/srv/odoo/extra-addons/hr_attendance_missing_days/models/hr_employee.py", line 90, in _create_missing_attendances
self.env["hr.attendance"].create(vals)
File "<decorator-gen-159>", line 2, in create
File "/usr/lib/python3/dist-packages/odoo/api.py", line 418, in _model_create_multi
return create(self, arg)
File "/usr/lib/python3/dist-packages/odoo/addons/hr_attendance/models/hr_attendance.py", line 281, in create
res = super().create(vals_list)
File "<decorator-gen-69>", line 2, in create
File "/usr/lib/python3/dist-packages/odoo/api.py", line 418, in _model_create_multi
return create(self, arg)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_fields.py", line 613, in create
recs = super().create(vals_list)
File "<decorator-gen-15>", line 2, in create
File "/usr/lib/python3/dist-packages/odoo/api.py", line 418, in _model_create_multi
return create(self, arg)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4088, in create
records = self._create(data_list)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4253, in _create
records._validate_fields(name for data in data_list for name in data['stored'])
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1371, in _validate_fields
check(self)
File "/srv/odoo/extra-addons/hr_attendance_autoclose/models/hr_attendance.py", line 57, in _check_validity
return super()._check_validity()
File "/usr/lib/python3/dist-packages/odoo/addons/hr_attendance/models/hr_attendance.py", line 78, in _check_validity
raise exceptions.ValidationError(_("Cannot create new attendance record for %(empl_name)s, the employee was already checked in on %(datetime)s") % {
odoo.exceptions.ValidationError: Cannot create new attendance record for XXXXXXXX, the employee was already checked in on 25.11.2023 00:00

@hbrunn bitte analysieren und ggf. als PR an OCA/hr-attendance#140 stellen.

@albig albig added bug Something isn't working Prio 1 labels Dec 22, 2023
hbrunn added a commit to hbrunn/odoo-customize that referenced this issue Dec 23, 2023
hbrunn added a commit to hbrunn/odoo-customize that referenced this issue Dec 23, 2023
hbrunn added a commit to hbrunn/odoo-customize that referenced this issue Dec 23, 2023
@hbrunn
Copy link
Contributor

hbrunn commented Dec 23, 2023

ist erledigt in initOS/hr-attendance#1

und hier dann benutzt: #89

hbrunn added a commit to hbrunn/odoo-customize that referenced this issue Dec 23, 2023
hbrunn added a commit to hbrunn/odoo-customize that referenced this issue Dec 23, 2023
@albig
Copy link
Member Author

albig commented Jan 3, 2024

Ich hab jetzt noch mal eine Weile getestet. Dein Fix löst das konkrete Problem.

Was ich leider nicht verstehe: Lege ich einen Attendance-Record manuell an, der über Mitternacht geht, stört das hr_attendance_missing_days. Ich seh hier keinen Unterschied :-(

@albig albig linked a pull request Jan 3, 2024 that will close this issue
@albig albig closed this as completed in #89 Jan 3, 2024
albig added a commit that referenced this issue Jan 3, 2024
@hbrunn
Copy link
Contributor

hbrunn commented Jan 15, 2024

das Problem das Du beschreibst bekomme ich nicht reproduziert, kannst Du hier noch etwas mehr schreiben?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Prio 1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants