diff --git a/assopy/stats.py b/assopy/stats.py index 568c272ba..17f353f7a 100644 --- a/assopy/stats.py +++ b/assopy/stats.py @@ -191,9 +191,9 @@ def _calc_prices(order_id, items): tcp[code]['prices'][price]['count'] += 1 # Replace prices dicts with sorted lists for code in tcp.keys(): - prices_list = [entry - for price, entry in sorted(list(tcp[code]['prices'].items()), - reverse=True)] + prices_list = [ + entry for price, entry in sorted(tcp[code]['prices'].items(), reverse=True) + ] tcp[code]['prices'] = prices_list # Create list sorted by fare code ticket_sales = [entry for code, entry in sorted(tcp.items())] diff --git a/conference/debug_panel.py b/conference/debug_panel.py index 20bea09f0..ad69e3b48 100644 --- a/conference/debug_panel.py +++ b/conference/debug_panel.py @@ -29,8 +29,8 @@ REAL_INVOICE_PREFIX, next_invoice_code_for_year, render_invoice_as_html, - export_invoices_to_2018_tax_report, - export_invoices_to_2018_tax_report_csv, + export_invoices_to_tax_report, + export_invoices_to_tax_report_csv, export_invoices_for_payment_reconciliation, extract_customer_info, ) @@ -187,9 +187,9 @@ def debug_panel_invoice_example(request): @staff_member_required -def debug_panel_invoice_export_for_tax_report_2018(request): +def debug_panel_invoice_export_for_tax_report(request): start_date, end_date = get_start_end_dates(request) - invoices_and_exported = export_invoices_to_2018_tax_report( + invoices_and_exported = export_invoices_to_tax_report( start_date, end_date ) @@ -203,13 +203,13 @@ def debug_panel_invoice_export_for_tax_report_2018(request): @staff_member_required -def debug_panel_invoice_export_for_tax_report_2018_csv(request): +def debug_panel_invoice_export_for_tax_report_csv(request): response = HttpResponse(content_type='text/csv') response['Content-Disposition'] =\ 'attachment; filename="export-invoices.csv"' start_date, end_date = get_start_end_dates(request) - export_invoices_to_2018_tax_report_csv(response, start_date, end_date) + export_invoices_to_tax_report_csv(response, start_date, end_date) return response @@ -274,7 +274,7 @@ class Meta: new_invoice.html = render_invoice_as_html(new_invoice) new_invoice.save() - return redirect('debug_panel_invoice_export_for_tax_report_2018') + return redirect('debug_panel_invoice_export_for_tax_report') else: customer = ( old_invoice.customer @@ -350,11 +350,11 @@ class FareSetup: debug_panel_invoice_force_preview, name="debug_panel_invoice_forcepreview"), url(r'^invoices_export/$', - debug_panel_invoice_export_for_tax_report_2018, - name='debug_panel_invoice_export_for_tax_report_2018'), + debug_panel_invoice_export_for_tax_report, + name='debug_panel_invoice_export_for_tax_report'), url(r'^invoices_export.csv$', - debug_panel_invoice_export_for_tax_report_2018_csv, - name='debug_panel_invoice_export_for_tax_report_2018_csv'), + debug_panel_invoice_export_for_tax_report_csv, + name='debug_panel_invoice_export_for_tax_report_csv'), url(r'^invoices_export_for_accounting.json$', debug_panel_invoice_export_for_payment_reconciliation_json, name='debug_panel_invoice_export_for_payment_reconciliation_json'), diff --git a/conference/invoicing.py b/conference/invoicing.py index 6179f95e3..18ba0086b 100644 --- a/conference/invoicing.py +++ b/conference/invoicing.py @@ -291,7 +291,7 @@ def render_invoice_as_html(invoice): return render_to_string('assopy/invoice.html', ctx) -CSV_2018_REPORT_COLUMNS = [ +CSV_REPORT_COLUMNS = [ 'ID', 'Emit Date', 'Buyer Name', @@ -299,13 +299,16 @@ def render_invoice_as_html(invoice): 'Address', 'Country', 'VAT ID', - 'Net Price in GBP', - 'VAT in GBP', - 'Gross Price in GBP', + 'Currency', + 'Net Price', + 'VAT', + 'Gross Price', ] +# For b/w compatibility +CSV_2018_REPORT_COLUMNS = CSV_REPORT_COLUMNS -def export_invoices_to_2018_tax_report(start_date, end_date=None): +def export_invoices_to_tax_report(start_date, end_date=None): if end_date is None: end_date = datetime.date.today() @@ -329,21 +332,22 @@ def export_invoices_to_2018_tax_report(start_date, end_date=None): output['Country'] = "" output['VAT ID'] = invoice.order.vat_number - output['Net Price in %s' % invoice.local_currency] =\ + output['Currency'] = invoice.local_currency + output['Net Price'] =\ invoice.net_price_in_local_currency - output['VAT in %s' % invoice.local_currency] =\ + output['VAT'] =\ invoice.vat_in_local_currency - output['Gross Price in %s' % invoice.local_currency] =\ + output['Gross Price'] =\ invoice.price_in_local_currency yield invoice, output -def export_invoices_to_2018_tax_report_csv(fp, start_date, end_date=None): - writer = csv.DictWriter(fp, CSV_2018_REPORT_COLUMNS, quoting=csv.QUOTE_ALL) +def export_invoices_to_tax_report_csv(fp, start_date, end_date=None): + writer = csv.DictWriter(fp, CSV_REPORT_COLUMNS, quoting=csv.QUOTE_ALL) writer.writeheader() - for invoice, to_export in export_invoices_to_2018_tax_report( + for invoice, to_export in export_invoices_to_tax_report( start_date, end_date ): writer.writerow(to_export) diff --git a/p3/management/commands/video_schedule_xlsx.py b/p3/management/commands/video_schedule_xlsx.py index 333f6c59c..a07d308f1 100644 --- a/p3/management/commands/video_schedule_xlsx.py +++ b/p3/management/commands/video_schedule_xlsx.py @@ -39,7 +39,7 @@ LICENSE = """ License: This video is licensed under the CC BY-NC-SA 3.0 license: https://creativecommons.org/licenses/by-nc-sa/3.0/ -Please see our speaker release agreement for details: https://ep2018.europython.eu/en/speaker-release-agreement/ +Please see our speaker release agreement for details: https://ep2019.europython.eu/events/speaker-release-agreement/ """ # Special handling of poster sessions diff --git a/templates/conference/debugpanel/index.html b/templates/conference/debugpanel/index.html index 5eb039f19..62db60ae2 100644 --- a/templates/conference/debugpanel/index.html +++ b/templates/conference/debugpanel/index.html @@ -18,8 +18,8 @@

Additional links

diff --git a/templates/conference/debugpanel/invoices_export.html b/templates/conference/debugpanel/invoices_export.html index 512a6da56..dfbdaab41 100644 --- a/templates/conference/debugpanel/invoices_export.html +++ b/templates/conference/debugpanel/invoices_export.html @@ -35,7 +35,7 @@

Invoices (from {{ start_date|date:"Y-m-d" }} to {{ end_date|date:"Y-m-d" }})

- Download the CSV file + Download the CSV file Download as JSON (for payment reco)

diff --git a/tests/test_invoices.py b/tests/test_invoices.py index 67d0a2a46..5e6e72213 100644 --- a/tests/test_invoices.py +++ b/tests/test_invoices.py @@ -602,7 +602,7 @@ def test_export_invoice_csv(client): query_string = query_dict.urlencode() response = client.get( - reverse("debug_panel_invoice_export_for_tax_report_2018_csv") + reverse("debug_panel_invoice_export_for_tax_report_csv") + "?" + query_string ) @@ -624,6 +624,7 @@ def test_export_invoice_csv(client): next(iter_column) # ignore the address assert next(iter_column) == invoice1.order.country.name assert next(iter_column) == invoice1.order.vat_number + next(iter_column) # ignore the currency assert ( decimal.Decimal(next(iter_column)) == invoice1.net_price_in_local_currency @@ -656,7 +657,7 @@ def test_export_invoice_csv_before_period(client): query_string = query_dict.urlencode() response = client.get( - reverse("debug_panel_invoice_export_for_tax_report_2018_csv") + reverse("debug_panel_invoice_export_for_tax_report_csv") + "?" + query_string ) @@ -692,7 +693,7 @@ def test_export_invoice(client): query_string = query_dict.urlencode() response = client.get( - reverse("debug_panel_invoice_export_for_tax_report_2018") + reverse("debug_panel_invoice_export_for_tax_report") + "?" + query_string )