Skip to content

Commit

Permalink
Fix duplicate invoices on proposal. Closes #31.
Browse files Browse the repository at this point in the history
  • Loading branch information
fgaudin committed Feb 11, 2011
1 parent e94c31f commit 0ed0edd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions project/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,3 +772,13 @@ def testContractDownloadPdf(self):
invariant_content = content[0:56] + content[57:108] + content[109:-1]
self.assertEquals(hashlib.md5("\n".join(invariant_content)).hexdigest(),
"40ad0f0fe2051217c71c4fe35a158825")

class Bug31Test(TestCase):
fixtures = ['test_dashboard_product_sales']

def setUp(self):
self.client.login(username='test', password='test')

def testDuplicateInvoicesOnProposal(self):
response = self.client.get(reverse('proposal_detail', kwargs={'id': 10}))
self.assertEquals(len(response.context['invoices']), 2)
2 changes: 1 addition & 1 deletion project/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def proposal_create_or_edit(request, id=None, project_id=None):
@settings_required
def proposal_detail(request, id):
proposal = get_object_or_404(Proposal, pk=id, owner=request.user)
invoices = Invoice.objects.filter(invoice_rows__proposal=proposal)
invoices = Invoice.objects.filter(invoice_rows__proposal=proposal).distinct()
next_states = proposal.get_next_states()

return render_to_response('proposal/detail.html',
Expand Down

0 comments on commit 0ed0edd

Please sign in to comment.