From 659eab8efb8643f4e1cb43ed6c16b6e44a973e21 Mon Sep 17 00:00:00 2001 From: Simon Maillard Date: Tue, 10 Sep 2024 11:58:20 +0200 Subject: [PATCH] [FIX] hr_timesheet_sheet: deal with time off line Fixes inability to add lines to timesheets that containstime off lines, managed from project_timesheet_holidays. Fixes https://github.com/OCA/timesheet/issues/711 --- hr_timesheet_sheet/models/hr_timesheet_sheet.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hr_timesheet_sheet/models/hr_timesheet_sheet.py b/hr_timesheet_sheet/models/hr_timesheet_sheet.py index b494798e11..5b301f3df4 100644 --- a/hr_timesheet_sheet/models/hr_timesheet_sheet.py +++ b/hr_timesheet_sheet/models/hr_timesheet_sheet.py @@ -677,9 +677,8 @@ def add_line(self): if existing_unique_ids: self.delete_empty_lines(False) if frozenset(new_line_unique_id.items()) not in existing_unique_ids: - self.timesheet_ids |= self.env["account.analytic.line"]._sheet_create( - values - ) + new_line = self.env["account.analytic.line"]._sheet_create(values) + self.write({"timesheet_ids": [(4, new_line.id)]}) def link_timesheets_to_sheet(self, timesheets): self.ensure_one()