0002-contrib.teamnet_axel-invoice-details-endpoint-8035.patch
passerelle/contrib/teamnet_axel/templates/passerelle/contrib/teamnet_axel/detail.html | ||
---|---|---|
49 | 49 |
{{ site_base_uri }}{{ active_invoices_url }}?NameID=... |
50 | 50 |
</a> <em>42</em> {% trans 'is regie identifier' %} |
51 | 51 |
</li> |
52 |
<li>{% trans 'Show invoice details:' %} |
|
53 |
{% url 'teamnet-axel-invoice' slug=object.slug regie_id='42' invoice_id='2345-20150916' as invoice_details_url %} |
|
54 |
<a href="{{ invoice_details_url }}"> |
|
55 |
{{ site_base_uri }}{{ invoice_details_url }} |
|
56 |
</a> |
|
57 |
<em>42</em> {% trans 'is regie identifier' %}, |
|
58 |
<em>2345</em> {% trans 'is family identifier' %}, |
|
59 |
<em>20150916</em> {% trans 'is invoice identifier' %} |
|
60 |
</li> |
|
52 | 61 |
</ul> |
53 | 62 |
</div> |
54 | 63 |
passerelle/contrib/teamnet_axel/urls.py | ||
---|---|---|
39 | 39 |
name='teamnet-axel-past-invoices'), |
40 | 40 |
url(r'^(?P<slug>[\w,-]+)/regie/(?P<regie_id>[\w,-]+)/invoices/$', ActiveInvoicesView.as_view(), |
41 | 41 |
name='teamnet-axel-active-invoices'), |
42 |
#url(r'^(?P<slug>[\w,-]+)/invoice/(?P<id>[\w,-]+)/$', InvoiceView.as_view(),
|
|
43 |
# name='teamnet-axel-invoice'),
|
|
42 |
url(r'^(?P<slug>[\w,-]+)/regie/(?P<regie_id>[\w,-]+)/invoice/(?P<invoice_id>[\w,-]+)/$', InvoiceView.as_view(),
|
|
43 |
name='teamnet-axel-invoice'), |
|
44 | 44 |
#url(r'^(?P<slug>[\w,-]+)/invoice-pdf/(?P<id>[\w,-]+)/$', InvoicePDFView.as_view(), |
45 | 45 |
# name='teamnet-axel-unlink'), |
46 | 46 |
#url(r'^(?P<slug>[\w,-]+)/invoice-paid/(?P<id>[\w,-]+)/$', InvoicePayView.as_view(), |
passerelle/contrib/teamnet_axel/views.py | ||
---|---|---|
159 | 159 |
months, **kwargs) |
160 | 160 |
active = super(PastInvoicesView, self).get_data(request, regie_id, **kwargs) |
161 | 161 |
return [p for p in past if p not in active] |
162 | ||
163 | ||
164 |
class InvoiceView(InvoicesMixin, FamilyView): |
|
165 | ||
166 |
def get_data(self, request, *args, **kwargs): |
|
167 |
family_id, invoice_id = kwargs['invoice_id'].split('-', 1) |
|
168 |
invoices = self.object.get_invoices(kwargs['regie_id'], family_id, |
|
169 |
months=12) |
|
170 |
for invoice in invoices: |
|
171 |
if invoice['id'] == invoice_id: |
|
172 |
return invoice |
|
162 |
- |