# Copyright 2018-Today datenpol gmbh () # License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses). from odoo import api, models class AccountInvoice(models.Model): _inherit = 'account.invoice' @api.multi def order_lines_layouted(self): res = super(AccountInvoice, self).order_lines_layouted() uncategorized = False # Rechnungszeilen ohne Kategorie löschen und an den Anfang stellen for idx1, page in enumerate(res): for idx2, category in enumerate(page): if category.get('name') == 'Uncategorized': uncategorized = page.pop(idx2) if uncategorized: res[idx1] = [uncategorized] + res[idx1] return res