title: What does mean for sub_ids in grouped_slice(ids) in Tryton?
body: <p>I want to understand an instruction that I have seen a lot. What does <code>for sub_ids in grouped_slice(ids)</code> mean in Tryton?</p>
  <p>Here is a fragment of a method where such instruction is used:</p>
  <pre><code>@classmethod
  def get_duration(cls, works, name):
      pool = Pool()
      Line = pool.get('timesheet.line')
      transaction = Transaction()
      cursor = transaction.connection.cursor()
      context = transaction.context
  
      table_w = cls.__table__()
      line = Line.__table__()
      ids = [w.id for w in works]
      durations = dict.fromkeys(ids, None)
      where = Literal(True)
      if context.get('from_date'):
          where &amp;= line.date &gt;= context['from_date']
      if context.get('to_date'):
          where &amp;= line.date &lt;= context['to_date']
      if context.get('employees'):
          where &amp;= line.employee.in_(context['employees'])
  
      query_table = table_w.join(line, 'LEFT',
          condition=line.work == table_w.id)
  
      for sub_ids in grouped_slice(ids):
          red_sql = reduce_ids(table_w.id, sub_ids)
          cursor.execute(*query_table.select(table_w.id, Sum(line.duration),
                  where=red_sql &amp; where,
                  group_by=table_w.id))
          for work_id, duration in cursor:
              # SQLite uses float for SUM
              if duration and not isinstance(duration, datetime.timedelta):
                  duration = datetime.timedelta(seconds=duration)
              durations[work_id] = duration
      return durations
  </code></pre>