optimize generation of pdf if its not stored to db

This commit is contained in:
Frederik Jaeckel 2024-12-12 12:37:56 +01:00
parent 25986aeae9
commit aa0134a67d
2 changed files with 48 additions and 22 deletions

View file

@ -118,21 +118,10 @@ class RunXRechnungReport(Wizard):
'invoice_report_cache_id': None,
'invoice_report_format': None}])
to_generate = [x.id for x in invoices if not x.invoice_report_cache]
to_generate = [x for x in invoices if not x.invoice_report_cache]
if to_generate:
report_action = XReport.get_used_report()
# run selected report on invoices w/o stored report-data
data2 = {}
data2.update(data)
data2['action_id'] = report_action.id
data2['model'] = report_action.model
data2['id'] = to_generate[0]
data2['ids'] = to_generate
RepInvoice = pool.get(report_action.report_name, type='report')
with Transaction().set_context({'with_rec_name': False}):
RepInvoice.execute(to_generate, data2)
# the pdf should be stored in db...
XReport.generate_pdf_data(to_generate)
def do_export(self, action):
""" run export
@ -151,7 +140,6 @@ class RunXRechnungReport(Wizard):
if data['edocument'] == 'edocument.facturxext.invoice-ferd':
# pdf is stored to db
self.generate_invoice_reports(data)
return action, data
# end RunXRechnungReport