Skip to content

Commit

Permalink
Fix regression of bug 141. Closes fgaudin#141.
Browse files Browse the repository at this point in the history
  • Loading branch information
fgaudin committed May 1, 2011
1 parent 4e61ab8 commit c5cacaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def invoice_footer(canvas, doc):
for row in rows:
label = row.label
if row.proposal.reference:
label = "%s - [%s]" % (label.decode('utf-8'), row.proposal.reference)
label = u"%s - [%s]" % (label, row.proposal.reference)
para = Paragraph(label, styleLabel)
para.width = label_width
splitted_para = para.breakLines(label_width)
Expand Down
9 changes: 8 additions & 1 deletion accounts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ class InvoiceTest(TestCase):
def setUp(self):
self.client.login(username='test', password='test')
self.proposal = Proposal.objects.create(project_id=30,
reference='crt1234',
update_date=datetime.date.today(),
state=PROPOSAL_STATE_ACCEPTED,
begin_date=datetime.date(2010, 8, 1),
Expand Down Expand Up @@ -797,7 +798,7 @@ def testDownloadPdf(self):
content = response.content.split("\n")
invariant_content = content[0:66] + content[67:110] + content[111:-1]
self.assertEquals(hashlib.md5("\n".join(invariant_content)).hexdigest(),
"ff8cfd8a5c6805d86a9a52e925ebfcce")
"51ab402a56612fac9112dc63c0e72884")

def testInvoiceBookDownloadPdf(self):
"""
Expand Down Expand Up @@ -1113,6 +1114,12 @@ def testBug141(self):
response = self.client.get(reverse('invoice_download', kwargs={'id': i.id}))
self.assertEqual(response.status_code, 200)

self.proposal.reference = ''
self.proposal.save()

response = self.client.get(reverse('invoice_download', kwargs={'id': i.id}))
self.assertEqual(response.status_code, 200)

def testBug204(self):
i = Invoice.objects.create(customer_id=self.proposal.project.customer_id,
invoice_id=1,
Expand Down

0 comments on commit c5cacaf

Please sign in to comment.