Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ <h2 class="flex-1 font-light">{% trans "My active invoices" %}</h2>
<div class="wrapper wrapper--status-bar-outer">
<div class="flex flex-wrap justify-between wrapper ps-4 pe-4">
<div class="flex flex-col my-auto md:w-1/3 item-start">
<h4 class="font-bold heading heading--no-margin"><a class="link" href="{{ invoice.get_absolute_url }}">
{% if invoice.invoice_number %}{{ invoice.invoice_number }}{% else %}{{ invoice.vendor_document_number }}{% endif %}
</a></h4>
<h4 class="font-bold heading heading--no-margin">
<a class="link" href="{{ invoice.get_absolute_url }}">
{{ invoice.invoice_number }}
</a>
</h4>
<p class="m-0 text-sm text-fg-muted">{% trans "Date added: " %} {{ invoice.requested_at }}</p>
</div>
<div class="flex flex-col items-center my-auto text-center md:w-1/3">
Expand Down
13 changes: 1 addition & 12 deletions hypha/apply/projects/models/payment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import decimal
import os
from textwrap import wrap

from django.conf import settings
from django.core.validators import MinValueValidator
Expand Down Expand Up @@ -141,7 +140,7 @@ def __str__(self):
)
def transition_invoice_to_resubmitted(self):
"""
Tranistion invoice to resubmitted status.
Transition invoice to resubmitted status.
This method generally gets used on invoice edit.
"""
pass
Expand All @@ -154,16 +153,6 @@ def has_changes_requested(self):
def status_display(self):
return self.get_status_display()

@property
def vendor_document_number(self):
"""
Vendor document number is a required field to create invoices in IntAcct.

Formatting should be HP###### i.e. HP000001 and so on.
"""
prefix = "HP-"
return prefix + "-".join(wrap(f"{self.id:06}", 3))

def can_user_delete(self, user):
if user.is_applicant or user.is_apply_staff:
if self.status in (SUBMITTED):
Expand Down
1 change: 0 additions & 1 deletion hypha/core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def global_vars(request):
"HIDE_IDENTITY_FROM_REVIEWERS": settings.HIDE_IDENTITY_FROM_REVIEWERS,
"GOOGLE_OAUTH2": settings.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY,
"ENABLE_PUBLIC_SIGNUP": settings.ENABLE_PUBLIC_SIGNUP,
"ENABLE_GOOGLE_TRANSLATE": settings.ENABLE_GOOGLE_TRANSLATE,
"SENTRY_TRACES_SAMPLE_RATE": settings.SENTRY_TRACES_SAMPLE_RATE,
"SENTRY_ENVIRONMENT": settings.SENTRY_ENVIRONMENT,
"SENTRY_DENY_URLS": settings.SENTRY_DENY_URLS,
Expand Down
33 changes: 5 additions & 28 deletions hypha/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@
# Make sure the set lang code is included in LANGUAGES setting.
LANGUAGE_CODE = env.str("LANGUAGE_CODE", "en")

LOCALE_PATHS = (PROJECT_DIR + "/locale",)

# Optional language switcher
# Set LANGUAGE setting to limit the languages available.
LANGUAGE_SWITCHER = env.bool("LANGUAGE_SWITCHER", False)
Expand Down Expand Up @@ -567,27 +569,16 @@

# Django Elevate settings
# https://django-elevate.readthedocs.io/en/latest/config/index.html

# ------------------------------------------------------------------------------
# How long should Elevate mode be active for?
ELEVATE_COOKIE_AGE = env.int("ELEVATE_COOKIE_AGE", 3600) # 1 hours

# An extra salt to be added into the cookie signature.
ELEVATE_COOKIE_SALT = env.str("ELEVATE_COOKIE_SALT", SECRET_KEY)


# Rest Framework settings
REST_FRAMEWORK = {
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
"PAGE_SIZE": 10,
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework.authentication.SessionAuthentication",
),
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
}


# django-file-form settings

# ------------------------------------------------------------------------------
FILE_FORM_CACHE = "django_file_form"
FILE_FORM_UPLOAD_DIR = "temp_uploads"
# Ensure FILE_FORM_UPLOAD_DIR exists:
Expand All @@ -597,24 +588,12 @@
FILE_FORM_TEMP_STORAGE = PRIVATE_FILE_STORAGE


# Sage IntAcct integration settings

INTACCT_ENABLED = env.bool("INTACCT_ENABLED", False)
INTACCT_SENDER_ID = env.str("INTACCT_SENDER_ID", "")
INTACCT_SENDER_PASSWORD = env.str("INTACCT_SENDER_PASSWORD", "")
INTACCT_USER_ID = env.str("INTACCT_USER_ID", "")
INTACCT_COMPANY_ID = env.str("INTACCT_COMPANY_ID", "")
INTACCT_USER_PASSWORD = env.str("INTACCT_USER_PASSWORD", "")


# Misc settings

# ------------------------------------------------------------------------------
# Use Pillow to create QR codes so they are PNG and not SVG.
# Apples Safari on iOS and macOS can then recognise them automatically.
# TWO_FACTOR_QR_FACTORY = 'qrcode.image.pil.PilImage'

LOCALE_PATHS = (PROJECT_DIR + "/locale",)

DEBUG = False
DEBUGTOOLBAR = False

Expand All @@ -628,8 +607,6 @@
"KV": "Kosovo",
}

# Google Translate
ENABLE_GOOGLE_TRANSLATE = env.bool("ENABLE_GOOGLE_TRANSLATE", True)

# Sentry configuration.
# -----------------------------------------------------------------------------
Expand Down
4 changes: 0 additions & 4 deletions hypha/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,4 @@
"SHOW_COLLAPSED": True,
}

# Required for testing the apis from postman
REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"] = REST_FRAMEWORK[
"DEFAULT_AUTHENTICATION_CLASSES"
] + ("rest_framework.authentication.BasicAuthentication",)
SENTRY_DENY_URLS += ["__reload__", "/favicon.ico", "/media/", "/static/", "__debug__"]
Loading