Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: HR Timesheet Sheet

Entity: hr_timesheet.sheet

Compute Method: _compute_line_ids

Inputs Method Outputs
SheetLine = self.env["hr_timesheet.sheet.line"]
for sheet in self:
            if not all([sheet.date_start, sheet.date_end]):
                continue
            matrix = sheet._get_data_matrix()
            vals_list = []
            for key in sorted(matrix, key=lambda key: sheet._get_matrix_sortby(key)):
                vals_list.append(sheet._get_default_sheet_line(matrix, key))
                if sheet.state in ["new", "draft"] and self.env.context.get(
                    "hr_timesheet_sheet_clean_timesheets", True
                ):
                    sheet.clean_timesheets(matrix[key])
            sheet.line_ids = [(6, 0, SheetLine.create(vals_list).ids)]

Back to entity