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_count

Inputs Method Outputs
  • id
timesheet_data = self.env['account.analytic.line']._read_group([('timesheet_invoice_id', 'in', self.ids)], ['timesheet_invoice_id'], ['__count'])
mapped_data = {timesheet_invoice.id: count for timesheet_invoice, count in timesheet_data}
for invoice in self:
            invoice.timesheet_count = mapped_data.get(invoice.id, 0)

Back to entity