Skip to content

[18.0][FIX] hr_timesheet_sheet_attendance: make _check_timesheet multi-record safe - #947

Open
renzo1974 wants to merge 1 commit into
OCA:18.0from
renzo1974:18.0-fix-hr_timesheet_sheet_attendance-multi-record
Open

[18.0][FIX] hr_timesheet_sheet_attendance: make _check_timesheet multi-record safe#947
renzo1974 wants to merge 1 commit into
OCA:18.0from
renzo1974:18.0-fix-hr_timesheet_sheet_attendance-multi-record

Conversation

@renzo1974

Copy link
Copy Markdown

The constraint read self.sheet_id and self.check_in directly on the recordset.

Odoo passes the whole affected recordset to @api.constrains, so creating or writing several attendances at once raised "ValueError: Expected singleton" as soon as a timesheet sheet covered the period - hitting list view multi-edit, imports and any module that creates attendances in batch.

Worse, on create the error is raised after the rows are inserted, so a caught exception leaves the attendances in place while everything hooked after core create is skipped.

Iterate over self and add a regression test covering both the valid batch and a batch containing one offending record.

…rd safe

The constraint read self.sheet_id and self.check_in directly on the
recordset. Odoo passes the whole affected recordset to @api.constrains, so
creating or writing several attendances at once raised
"ValueError: Expected singleton" as soon as a timesheet sheet covered the
period - hitting list view multi-edit, imports and any module that creates
attendances in batch.

Worse, on create the error is raised after the rows are inserted, so a
caught exception leaves the attendances in place while everything hooked
after core create is skipped.

Iterate over self and add a regression test covering both the valid batch
and a batch containing one offending record.
@OCA-git-bot OCA-git-bot added mod:hr_timesheet_sheet_attendance Module hr_timesheet_sheet_attendance series:18.0 labels Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:hr_timesheet_sheet_attendance Module hr_timesheet_sheet_attendance series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants