[V7.1] Error when calling print view

hi all

have the following error

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 55, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 19, in handle
execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 890, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/www/print.py”, line 175, in get_html_and_style
no_letterhead=no_letterhead, trigger_print=trigger_print),
File “/home/frappe/frappe-bench/apps/frappe/frappe/www/print.py”, line 138, in get_html
“layout”: make_layout(doc, meta, format_data),
File “/home/frappe/frappe-bench/apps/frappe/frappe/www/print.py”, line 295, in make_layout
page[-1][-1].append(df)
KeyError: -1
Report this issue

does only happen on paid status invioces not on overdue or draft
what needs changing?

error still persist even after update today…

the document has a pagebraek set

please help…

… I think the print.py stuggles with continuing the table on the new page

# continue the table in a new page
					df = copy.copy(df)
					df.start = i
					df.end = None
					page[-1][-1].append(df)

but I cant figure how to fix the key -
maybe the dictionary gets not updated properly when a page break is detected?
man, I need to get a deeper understanding of it all

@spa we have fixed issue via https://github.com/frappe/frappe/pull/2193

Thank you @saurabh6790

so I take it the error came up because wrong key

[-1][-1] - one of those has no reference

was called (or the key called was not referenced correctly) as we need to call

page[-1]['columns'][-1]['fields'].append(df)

instead of

page[-1][-1].append(df)

in order to get new page and its content and not new page separately?

that was fixes - thread obsolete

can be close thanks