forked from CGM_Public/pretix_original
Refactor into method in ClassicInvoiceRenderer
This commit is contained in:
@@ -457,19 +457,8 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
id='normal')
|
id='normal')
|
||||||
]
|
]
|
||||||
|
|
||||||
def _get_story(self, doc):
|
def _get_intro(self):
|
||||||
has_taxes = any(il.tax_value for il in self.invoice.lines.all())
|
story = []
|
||||||
|
|
||||||
story = [
|
|
||||||
NextPageTemplate('FirstPage'),
|
|
||||||
Paragraph(pgettext('invoice', 'Invoice')
|
|
||||||
if not self.invoice.is_cancellation
|
|
||||||
else pgettext('invoice', 'Cancellation'),
|
|
||||||
self.stylesheet['Heading1']),
|
|
||||||
Spacer(1, 5 * mm),
|
|
||||||
NextPageTemplate('OtherPages'),
|
|
||||||
]
|
|
||||||
|
|
||||||
if self.invoice.internal_reference:
|
if self.invoice.internal_reference:
|
||||||
story.append(Paragraph(
|
story.append(Paragraph(
|
||||||
pgettext('invoice', 'Customer reference: {reference}').format(reference=self.invoice.internal_reference),
|
pgettext('invoice', 'Customer reference: {reference}').format(reference=self.invoice.internal_reference),
|
||||||
@@ -494,6 +483,22 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
story.append(Paragraph(self.invoice.introductory_text, self.stylesheet['Normal']))
|
story.append(Paragraph(self.invoice.introductory_text, self.stylesheet['Normal']))
|
||||||
story.append(Spacer(1, 10 * mm))
|
story.append(Spacer(1, 10 * mm))
|
||||||
|
|
||||||
|
return story
|
||||||
|
|
||||||
|
def _get_story(self, doc):
|
||||||
|
has_taxes = any(il.tax_value for il in self.invoice.lines.all())
|
||||||
|
|
||||||
|
story = [
|
||||||
|
NextPageTemplate('FirstPage'),
|
||||||
|
Paragraph(pgettext('invoice', 'Invoice')
|
||||||
|
if not self.invoice.is_cancellation
|
||||||
|
else pgettext('invoice', 'Cancellation'),
|
||||||
|
self.stylesheet['Heading1']),
|
||||||
|
Spacer(1, 5 * mm),
|
||||||
|
NextPageTemplate('OtherPages'),
|
||||||
|
]
|
||||||
|
story += self._get_intro()
|
||||||
|
|
||||||
taxvalue_map = defaultdict(Decimal)
|
taxvalue_map = defaultdict(Decimal)
|
||||||
grossvalue_map = defaultdict(Decimal)
|
grossvalue_map = defaultdict(Decimal)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user