Accounting report: Allow subclasses to skip tables (#5616)

This commit is contained in:
Raphael Michel
2025-11-17 17:09:06 +01:00
committed by GitHub
parent 818bb76e89
commit 44b3647689

View File

@@ -858,50 +858,58 @@ class ReportExporter(ReportlabExportMixin, BaseExporter):
for c in currencies: for c in currencies:
c_head = f" [{c}]" if len(currencies) > 1 else "" c_head = f" [{c}]" if len(currencies) > 1 else ""
story += [ s = self._table_transactions(form_data, c)
Spacer(0, 3 * mm), if s:
FontFallbackParagraph(_("Orders") + c_head, style_h2), story += [
Spacer(0, 3 * mm), Spacer(0, 3 * mm),
*self._table_transactions(form_data, c), FontFallbackParagraph(_("Orders") + c_head, style_h2),
] Spacer(0, 3 * mm),
*s
]
for c in currencies: for c in currencies:
c_head = f" [{c}]" if len(currencies) > 1 else "" c_head = f" [{c}]" if len(currencies) > 1 else ""
story += [ s = self._table_payments(form_data, c)
Spacer(0, 8 * mm), if s:
FontFallbackParagraph(_("Payments") + c_head, style_h2), story += [
Spacer(0, 3 * mm), Spacer(0, 8 * mm),
*self._table_payments(form_data, c), FontFallbackParagraph(_("Payments") + c_head, style_h2),
] Spacer(0, 3 * mm),
*s
]
for c in currencies: for c in currencies:
c_head = f" [{c}]" if len(currencies) > 1 else "" c_head = f" [{c}]" if len(currencies) > 1 else ""
story += [ s = self._table_open_items(form_data, c)
Spacer(0, 8 * mm), if s:
KeepTogether( story += [
[ Spacer(0, 8 * mm),
FontFallbackParagraph(_("Open items") + c_head, style_h2), KeepTogether(
Spacer(0, 3 * mm), [
*self._table_open_items(form_data, c), FontFallbackParagraph(_("Open items") + c_head, style_h2),
] Spacer(0, 3 * mm),
), *s
] ]
),
]
if ( if (
self.is_multievent self.is_multievent
and self.events.count() == self.organizer.events.count() and self.events.count() == self.organizer.events.count()
): ):
for c in currencies: for c in currencies:
c_head = f" [{c}]" if len(currencies) > 1 else "" c_head = f" [{c}]" if len(currencies) > 1 else ""
story += [ s = self._table_gift_cards(form_data, c)
Spacer(0, 8 * mm), if s:
KeepTogether( story += [
[ Spacer(0, 8 * mm),
FontFallbackParagraph(_("Gift cards") + c_head, style_h2), KeepTogether(
Spacer(0, 3 * mm), [
*self._table_gift_cards(form_data, c), FontFallbackParagraph(_("Gift cards") + c_head, style_h2),
] Spacer(0, 3 * mm),
), *s,
] ]
),
]
doc.build(story, canvasmaker=self.canvas_class(doc)) doc.build(story, canvasmaker=self.canvas_class(doc))
f.seek(0) f.seek(0)