invoicing: fix journal url for invoice lines (#73918)
This commit is contained in:
parent
24898d08a1
commit
61124135b5
|
@ -1,3 +1,4 @@
|
|||
{% url 'lingo-manager-invoicing-pool-journal' pk=object.pk pool_pk=pool.pk as journal_url %}
|
||||
{% for line in object_list %}
|
||||
<li class="line" data-invoice-id="{{ line.invoice_id }}">
|
||||
<a href="{{ journal_url }}?pk={{ line.pk }}">#{{ line.pk }}</a>
|
||||
|
|
|
@ -461,16 +461,21 @@ class InvoiceLineListView(ListView):
|
|||
template_name = 'lingo/invoicing/manager_invoice_lines.html'
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
pool = get_object_or_404(Pool, pk=kwargs['pool_pk'], campaign_id=kwargs['pk'])
|
||||
self.pool = get_object_or_404(Pool, pk=kwargs['pool_pk'], campaign_id=kwargs['pk'])
|
||||
invoice_model = Invoice
|
||||
if pool.draft:
|
||||
if self.pool.draft:
|
||||
invoice_model = DraftInvoice
|
||||
self.invoice = get_object_or_404(invoice_model, pk=kwargs['invoice_pk'], pool=pool)
|
||||
self.invoice = get_object_or_404(invoice_model, pk=kwargs['invoice_pk'], pool=self.pool)
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
return self.invoice.lines.all().order_by('user_external_id', 'event_date', 'pk')
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs['object'] = self.pool.campaign
|
||||
kwargs['pool'] = self.pool
|
||||
return super().get_context_data(**kwargs)
|
||||
|
||||
|
||||
invoice_line_list = InvoiceLineListView.as_view()
|
||||
|
||||
|
|
Loading…
Reference in New Issue