Commit e617ce92 by chrisndodge

Merge pull request #6713 from edx/cdodge/no-tax-id-on-cc-receipts

Only put the TaxID for Invoices, not Credit Card based receipts
parents ab53bad8 62b58fce
...@@ -369,24 +369,34 @@ class PDFInvoice(object): ...@@ -369,24 +369,34 @@ class PDFInvoice(object):
totals_data = [ totals_data = [
[(_('Total')), self.total_cost], [(_('Total')), self.total_cost],
[(_('Payment Received')), self.payment_received], [(_('Payment Received')), self.payment_received],
[(_('Balance')), self.balance], [(_('Balance')), self.balance]
['', '{tax_label}: {tax_id}'.format(tax_label=self.tax_label, tax_id=self.tax_id)]
] ]
if self.is_invoice:
# only print TaxID if we are generating an Invoice
totals_data.append(
['', '{tax_label}: {tax_id}'.format(tax_label=self.tax_label, tax_id=self.tax_id)]
)
heights = 8 * mm heights = 8 * mm
totals_table = Table(totals_data, 40 * mm, heights) totals_table = Table(totals_data, 40 * mm, heights)
totals_table.setStyle(TableStyle([ styles = [
# Styling for the totals table. # Styling for the totals table.
('ALIGN', (0, 0), (-1, -1), 'RIGHT'), ('ALIGN', (0, 0), (-1, -1), 'RIGHT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('TEXTCOLOR', (0, 0), (-1, -1), colors.black), ('TEXTCOLOR', (0, 0), (-1, -1), colors.black),
# Styling for the Amounts cells # Styling for the Amounts cells
('RIGHTPADDING', (-1, 0), (-1, -2), 7 * mm), # NOTE: since we are not printing the TaxID for Credit Card
('GRID', (-1, 0), (-1, -2), 3.0, colors.white), # based receipts, we need to change the cell range for
('BACKGROUND', (-1, 0), (-1, -2), '#EEEEEE'), # these formatting rules
])) ('RIGHTPADDING', (-1, 0), (-1, -2 if self.is_invoice else -1), 7 * mm),
('GRID', (-1, 0), (-1, -2 if self.is_invoice else -1), 3.0, colors.white),
('BACKGROUND', (-1, 0), (-1, -2 if self.is_invoice else -1), '#EEEEEE'),
]
totals_table.setStyle(TableStyle(styles))
__, rendered_height = totals_table.wrap(0, 0) __, rendered_height = totals_table.wrap(0, 0)
......
...@@ -83,7 +83,7 @@ class TestPdfFile(unittest.TestCase): ...@@ -83,7 +83,7 @@ class TestPdfFile(unittest.TestCase):
self.assertTrue(any(str(self.total_cost) in s for s in pdf_content)) self.assertTrue(any(str(self.total_cost) in s for s in pdf_content))
self.assertTrue(any(str(self.payment_received) in s for s in pdf_content)) self.assertTrue(any(str(self.payment_received) in s for s in pdf_content))
self.assertTrue(any(str(self.balance) in s for s in pdf_content)) self.assertTrue(any(str(self.balance) in s for s in pdf_content))
self.assertTrue(any('edX Tax ID' in s for s in pdf_content)) self.assertFalse(any('edX Tax ID' in s for s in pdf_content))
# PDF_RECEIPT_TERMS_AND_CONDITIONS not displayed in the receipt pdf # PDF_RECEIPT_TERMS_AND_CONDITIONS not displayed in the receipt pdf
self.assertFalse(any( self.assertFalse(any(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment