'Returns this order lines classified by sale_layout_category and separated in
pages according to the category pagebreaks. Used to render the report.'

@api.multi
def order_lines_layouted(self):

    self.ensure_one()
    report_pages = [[]]
    for (category, lines) in groupby(self.order_line, (lambda l: l.layout_category_id)):
        if (report_pages[(-1)] and report_pages[(-1)][(-1)]['pagebreak']):
            report_pages.append([])
        report_pages[(-1)].append({'name': ((category and category.name) or 'Uncategorized'), 'subtotal': (category and category.subtotal), 'pagebreak': (category and category.pagebreak), 'lines': list(lines)})
    return report_pages
