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

[12.0][IMP] hr_timesheet_sheet: fix amount calculation issues + code simplification #211

Merged
merged 8 commits into from
Mar 25, 2019
6 changes: 3 additions & 3 deletions hr_timesheet_sheet/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ def _compute_line_ids(self):
if not all([sheet.date_start, sheet.date_end]):
continue
matrix = sheet._get_data_matrix()
lines = self.env['hr_timesheet.sheet.line']
vals_list = []
for item in sorted(matrix, key=lambda l: self._sort_matrix(l)):
vals = sheet._get_default_sheet_line(matrix, item)
lines |= self.env['hr_timesheet.sheet.line'].create(vals)
vals_list.append(sheet._get_default_sheet_line(matrix, item))
sheet.clean_timesheets(matrix[item])
lines = self.env['hr_timesheet.sheet.line'].create(vals_list)
sheet.line_ids = lines

def _sort_matrix(self, line):
Expand Down