Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Sales Timesheet
Entity: account.move
Compute Method: _compute_timesheet_total_duration
| Inputs | Method | Outputs |
|---|---|---|
|
- if not self.user_has_groups('hr_timesheet.group_hr_timesheet_user'): + if not self.env.user.has_group('hr_timesheet.group_hr_timesheet_user'): self.timesheet_total_duration = 0 return group_data = self.env['account.analytic.line']._read_group([ ('timesheet_invoice_id', 'in', self.ids) ], ['timesheet_invoice_id'], ['unit_amount:sum']) timesheet_unit_amount_dict = defaultdict(float) timesheet_unit_amount_dict.update({timesheet_invoice.id: amount for timesheet_invoice, amount in group_data}) for invoice in self: total_time = invoice.company_id.project_time_mode_id._compute_quantity( timesheet_unit_amount_dict[invoice.id], invoice.timesheet_encode_uom_id, rounding_method='HALF-UP', ) invoice.timesheet_total_duration = round(total_time) |
|
