Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DWPF-1473 Update python packages #496

Merged
merged 6 commits into from
Mar 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
black
SamDudley committed Mar 28, 2024
commit 6d5d29fa38c624b3906fc4e2f8576034a6eee1dc
64 changes: 40 additions & 24 deletions chartofaccountDIT/exportcsv.py
Original file line number Diff line number Diff line change
@@ -33,24 +33,36 @@ def _export_nac_iterator(queryset):
obj.natural_account_code_description,
] + l5_field_obj(obj.account_L5_code) + [
obj.used_for_budget,
obj.expenditure_category.NAC_category.NAC_category_description
if obj.expenditure_category
else "-",
obj.expenditure_category.grouping_description
if obj.expenditure_category
else "-",
obj.commercial_category.commercial_category
if obj.commercial_category
else "N/A",
obj.expenditure_category.op_del_category.operating_delivery_description
if obj.expenditure_category and obj.expenditure_category.op_del_category
else "N/A",
obj.expenditure_category.linked_budget_code.natural_account_code
if obj.expenditure_category
else "-",
obj.expenditure_category.NAC_category.get_pay_nonpay_display()
if obj.expenditure_category
else "N/A",
(
obj.expenditure_category.NAC_category.NAC_category_description
if obj.expenditure_category
else "-"
),
(
obj.expenditure_category.grouping_description
if obj.expenditure_category
else "-"
),
(
obj.commercial_category.commercial_category
if obj.commercial_category
else "N/A"
),
(
obj.expenditure_category.op_del_category.operating_delivery_description
if obj.expenditure_category and obj.expenditure_category.op_del_category
else "N/A"
),
(
obj.expenditure_category.linked_budget_code.natural_account_code
if obj.expenditure_category
else "-"
),
(
obj.expenditure_category.NAC_category.get_pay_nonpay_display()
if obj.expenditure_category
else "N/A"
),
obj.get_cash_non_cash_display(),
obj.get_gross_income_display(),
obj.active,
@@ -81,9 +93,11 @@ def _export_historical_nac_iterator(queryset):
obj.natural_account_code,
obj.natural_account_code_description,
obj.used_for_budget,
obj.expenditure_category.grouping_description
if obj.expenditure_category
else "-",
(
obj.expenditure_category.grouping_description
if obj.expenditure_category
else "-"
),
obj.NAC_category,
obj.commercial_category,
obj.account_L5_code,
@@ -117,9 +131,11 @@ def _export_exp_cat_iterator(queryset):
obj.further_description,
obj.linked_budget_code.natural_account_code,
obj.linked_budget_code.natural_account_code_description,
obj.op_del_category.operating_delivery_description
if obj.op_del_category
else "-",
(
obj.op_del_category.operating_delivery_description
if obj.op_del_category
else "-"
),
]


1 change: 1 addition & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from django.conf import settings
from django.contrib import admin
from django.urls import include, path
6 changes: 3 additions & 3 deletions core/no_cache_middleware.py
Original file line number Diff line number Diff line change
@@ -5,9 +5,9 @@ def __init__(self, get_response):

def __call__(self, request):
response = self.get_response(request)
response[
"Cache-Control"
] = "private, no-cache, no-store, must-revalidate" # noqa HTTP 1.1.
response["Cache-Control"] = (
"private, no-cache, no-store, must-revalidate" # noqa HTTP 1.1.
)
response["Pragma"] = "no-cache" # HTTP 1.0.
response["Expires"] = "0" # Proxies.

16 changes: 10 additions & 6 deletions costcentre/exportcsv.py
Original file line number Diff line number Diff line change
@@ -54,9 +54,11 @@ def export_cc_iterator(queryset):
obj.active,
obj.used_for_travel,
obj.disabled_with_actual,
obj.directorate.group.treasury_segment_fk.segment_long_name
if obj.directorate.group.treasury_segment_fk
else "-",
(
obj.directorate.group.treasury_segment_fk.segment_long_name
if obj.directorate.group.treasury_segment_fk
else "-"
),
]


@@ -86,9 +88,11 @@ def export_group_iterator(queryset):
yield [
obj.group_code,
obj.group_name,
obj.treasury_segment_fk.segment_long_name
if obj.treasury_segment_fk
else "-",
(
obj.treasury_segment_fk.segment_long_name
if obj.treasury_segment_fk
else "-"
),
obj.active,
]

4 changes: 2 additions & 2 deletions end_of_month/restore_archive.py
Original file line number Diff line number Diff line change
@@ -71,8 +71,8 @@ def restore_archive(period_id):
).update(archived=False, archived_date=None)

# Clear the actual loaded flag for periods after the se
FinancialPeriod.objects.filter(financial_period_code__gt=period_id,).update(
actual_loaded=False,
FinancialPeriod.objects.filter(financial_period_code__gt=period_id).update(
actual_loaded=False
)
# Refresh the views used to send daqta to data workspace
refresh_materialised_views()
16 changes: 7 additions & 9 deletions forecast/utils/export_helpers.py
Original file line number Diff line number Diff line change
@@ -176,22 +176,20 @@ def export_forecast_to_excel( # noqa C901
row_count += 1
# Formula for Year To Date. Don't use it if there are no actuals
if howmany_actuals:
ws[
f"{year_to_date_col}{row_count}"
].value = (
ws[f"{year_to_date_col}{row_count}"].value = (
f"=SUM({first_figure_col}{row_count}:{last_actual_col}{row_count})"
)
else:
if not display_future_years:
ws[f"{year_to_date_col}{row_count}"].value = 0

# Formula for calculating the full year
ws[
f"{year_total_col}{row_count}"
].value = f"=SUM({first_figure_col}{row_count}:{last_month_col}{row_count})"
ws[
f"{over_under_spend_col}{row_count}"
].value = f"=({budget_col}{row_count}-{year_total_col}{row_count})"
ws[f"{year_total_col}{row_count}"].value = (
f"=SUM({first_figure_col}{row_count}:{last_month_col}{row_count})"
)
ws[f"{over_under_spend_col}{row_count}"].value = (
f"=({budget_col}{row_count}-{year_total_col}{row_count})"
)

format_numbers(ws, row_count, budget_index)
unlock_forecast_cells(ws, row_count, first_forecast_index, last_month_index + 1)
5 changes: 4 additions & 1 deletion previous_years/archive_current_year_figure.py
Original file line number Diff line number Diff line change
@@ -22,7 +22,10 @@
def archive_to_temp_previous_year_figures(
row_to_archive, financial_year_obj, financialcode_obj
):
(previous_year_obj, created,) = ArchivedForecastDataUpload.objects.get_or_create(
(
previous_year_obj,
created,
) = ArchivedForecastDataUpload.objects.get_or_create(
financial_year=financial_year_obj,
financial_code=financialcode_obj,
)