Report help needed

I am currently creating a report. The following is a screenshot of a part of that report

When I run the server and print the report, it gives the data like this

I do not want extra blanks rows to appear but I want to keep the table format as it is(I do not want to place deductions below pay and allowances). I tried defining two lists as the follows:

def pay_and_allowances(self):
    allowances_lines = []
    if self.lines:
        for line in self.lines:
            if line.category.code in ['BASIC', 'ALW']:
    return allowances_lines


def deductions(self):
    deductions_lines = []
    if self.lines:
        for line in self.lines:
            if line.category.code in ['DED']:
    return deductions_lines

and applying them side by side in two separate for loops. But on trying to print the report, it gives me error about matching tags.

Please tell me whether there is a way to make this possible.

That’s probably because you did not close correctly som for loop or other tags.

I can not see any other error in the code you posted. Reports support the usage of python properties.

I was trying to use something like this

You can not have two loops mixed inside the same table.
You must use two tables or make a unique loop on both list using zip.

But using zip would truncate some values required in the table. Will try using zip_longest if possible.