finance: fix some translations, add statement submit button for excursions

v1-0-stable
Christian Merten 3 years ago
parent ee95ea4d83
commit 2eb664e35e
Signed by: christian.merten
GPG Key ID: D953D69721B948B3

@ -32,12 +32,12 @@ class BillOnStatementInline(admin.TabularInline):
@admin.register(StatementUnSubmitted) @admin.register(StatementUnSubmitted)
class StatementUnSubmitteddAdmin(admin.ModelAdmin): class StatementUnSubmittedAdmin(admin.ModelAdmin):
fields = ['short_description', 'explanation', 'excursion', 'submitted'] fields = ['short_description', 'explanation', 'excursion', 'submitted']
inlines = [BillOnStatementInline] inlines = [BillOnStatementInline]
def get_readonly_fields(self, request, obj=None): def get_readonly_fields(self, request, obj=None):
readonly_fields = ['submitted'] readonly_fields = ['submitted', 'excursion']
if obj is not None and obj.submitted: if obj is not None and obj.submitted:
return readonly_fields + self.fields return readonly_fields + self.fields
else: else:
@ -67,7 +67,7 @@ class StatementUnSubmitteddAdmin(admin.ModelAdmin):
if statement.submitted: if statement.submitted:
messages.error(request, messages.error(request,
_("%(name)s is already submitted.") % {'name': str(statement)}) _("%(name)s is already submitted.") % {'name': str(statement)})
return HttpResponseRedirect(reverse('admin:%s_%s_changelist' % (self.opts.app_label, self.opts.model_name), args=(statement.pk,))) return HttpResponseRedirect(reverse('admin:%s_%s_changelist' % (self.opts.app_label, self.opts.model_name)))
if "apply" in request.POST: if "apply" in request.POST:
statement.submit(get_member(request)) statement.submit(get_member(request))
@ -250,7 +250,11 @@ class TransactionAdmin(admin.ModelAdmin):
list_filter = ('ledger', 'member', 'statement', 'confirmed') list_filter = ('ledger', 'member', 'statement', 'confirmed')
search_fields = ('reference', ) search_fields = ('reference', )
fields = ['reference', 'amount', 'member', 'ledger', 'statement'] fields = ['reference', 'amount', 'member', 'ledger', 'statement']
readonly_fields = fields
def get_readonly_fields(self, request, obj=None):
if obj is not None and obj.confirmed:
return self.fields
return super(TransactionAdmin, self).get_readonly_fields(request, obj)
@admin.register(Bill) @admin.register(Bill)

@ -1,6 +1,8 @@
from django.apps import AppConfig from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class FinanceConfig(AppConfig): class FinanceConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField' default_auto_field = 'django.db.models.BigAutoField'
name = 'finance' name = 'finance'
verbose_name = _('Finance')

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-17 21:05+0100\n" "POT-Creation-Date: 2023-03-17 23:19+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -104,11 +104,15 @@ msgstr "Eingereichte Abrechnung einsehen"
msgid "Successfully reduced transactions for %(name)s." msgid "Successfully reduced transactions for %(name)s."
msgstr "Überweisungsträger für %(name)s minimiert." msgstr "Überweisungsträger für %(name)s minimiert."
#: apps.py:8
msgid "Finance"
msgstr "Finanzen"
#: models.py:13 #: models.py:13
msgid "Name" msgid "Name"
msgstr "Name" msgstr "Name"
#: models.py:19 models.py:351 models.py:375 #: models.py:19 models.py:352 models.py:376
#: templates/admin/confirmed_statement.html:38 #: templates/admin/confirmed_statement.html:38
#: templates/admin/overview_submitted_statement.html:100 #: templates/admin/overview_submitted_statement.html:100
msgid "Ledger" msgid "Ledger"
@ -118,7 +122,7 @@ msgstr "Geldtopf"
msgid "Ledgers" msgid "Ledgers"
msgstr "Geldtöpfe" msgstr "Geldtöpfe"
#: models.py:42 models.py:323 models.py:374 #: models.py:42 models.py:323 models.py:375
msgid "Short description" msgid "Short description"
msgstr "Kurzbeschreibung" msgstr "Kurzbeschreibung"
@ -146,7 +150,7 @@ msgstr "Eingereicht am"
msgid "Confirmed" msgid "Confirmed"
msgstr "Abgewickelt" msgstr "Abgewickelt"
#: models.py:57 models.py:358 #: models.py:57 models.py:359
msgid "Paid on" msgid "Paid on"
msgstr "Bezahlt am" msgstr "Bezahlt am"
@ -154,11 +158,11 @@ msgstr "Bezahlt am"
msgid "Submitted by" msgid "Submitted by"
msgstr "Eingereicht bei" msgstr "Eingereicht bei"
#: models.py:64 models.py:327 models.py:359 #: models.py:64 models.py:360
msgid "Authorized by" msgid "Authorized by"
msgstr "Autorisiert von" msgstr "Autorisiert von"
#: models.py:71 models.py:322 models.py:354 #: models.py:71 models.py:322 models.py:355
msgid "Statement" msgid "Statement"
msgstr "Abrechnung" msgstr "Abrechnung"
@ -208,6 +212,10 @@ msgstr "Bezahlte Abrechnung"
msgid "Paid statements" msgid "Paid statements"
msgstr "Bezahlte Abrechnungen" msgstr "Bezahlte Abrechnungen"
#: models.py:327
msgid "Paid by"
msgstr "Bezahlt von"
#: models.py:329 #: models.py:329
msgid "Covered" msgid "Covered"
msgstr "Übernommen" msgstr "Übernommen"
@ -220,32 +228,38 @@ msgstr "Ausgezahlt"
msgid "Proof" msgid "Proof"
msgstr "Beleg" msgstr "Beleg"
#: models.py:342 #: models.py:340 models.py:349 templates/admin/confirmed_statement.html:36
#: templates/admin/overview_submitted_statement.html:31
#: templates/admin/overview_submitted_statement.html:98
msgid "Amount"
msgstr "Betrag"
#: models.py:343
msgid "Bill" msgid "Bill"
msgstr "Quittung" msgstr "Quittung"
#: models.py:343 templates/admin/overview_submitted_statement.html:26 #: models.py:344 templates/admin/overview_submitted_statement.html:26
msgid "Bills" msgid "Bills"
msgstr "Quittungen" msgstr "Quittungen"
#: models.py:347 templates/admin/confirmed_statement.html:37 #: models.py:348 templates/admin/confirmed_statement.html:37
#: templates/admin/overview_submitted_statement.html:99 #: templates/admin/overview_submitted_statement.html:99
msgid "Reference" msgid "Reference"
msgstr "Verwendungszweck" msgstr "Verwendungszweck"
#: models.py:349 #: models.py:350
msgid "Recipient" msgid "Recipient"
msgstr "Empfänger" msgstr "Empfänger"
#: models.py:357 #: models.py:358
msgid "Paid" msgid "Paid"
msgstr "Bezahlt" msgstr "Bezahlt"
#: models.py:369 #: models.py:370
msgid "Transaction" msgid "Transaction"
msgstr "Überweisung" msgstr "Überweisung"
#: models.py:370 templates/admin/overview_submitted_statement.html:84 #: models.py:371 templates/admin/overview_submitted_statement.html:84
msgid "Transactions" msgid "Transactions"
msgstr "Überweisungen" msgstr "Überweisungen"
@ -275,12 +289,6 @@ msgstr ""
msgid "IBAN" msgid "IBAN"
msgstr "IBAN" msgstr "IBAN"
#: templates/admin/confirmed_statement.html:36
#: templates/admin/overview_submitted_statement.html:31
#: templates/admin/overview_submitted_statement.html:98
msgid "Amount"
msgstr "Betrag"
#: templates/admin/confirmed_statement.html:66 #: templates/admin/confirmed_statement.html:66
msgid "I did execute the listed transactions." msgid "I did execute the listed transactions."
msgstr "Ich habe die aufgeführten Überweisungen ausgeführt." msgstr "Ich habe die aufgeführten Überweisungen ausgeführt."

@ -324,7 +324,7 @@ class Bill(models.Model):
explanation = models.TextField(verbose_name=_('Explanation'), blank=True) explanation = models.TextField(verbose_name=_('Explanation'), blank=True)
amount = models.DecimalField(max_digits=6, decimal_places=2, default=0) amount = models.DecimalField(max_digits=6, decimal_places=2, default=0)
paid_by = models.ForeignKey(Member, verbose_name=_('Authorized by'), null=True, paid_by = models.ForeignKey(Member, verbose_name=_('Paid by'), null=True,
on_delete=models.SET_NULL) on_delete=models.SET_NULL)
costs_covered = models.BooleanField(verbose_name=_('Covered'), default=False) costs_covered = models.BooleanField(verbose_name=_('Covered'), default=False)
refunded = models.BooleanField(verbose_name=_('Refunded'), default=False) refunded = models.BooleanField(verbose_name=_('Refunded'), default=False)

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-02 12:55+0200\n" "POT-Creation-Date: 2023-03-17 23:10+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -22,6 +22,31 @@ msgstr ""
msgid "Startpage" msgid "Startpage"
msgstr "Startseite" msgstr "Startseite"
#: templates/admin/finance/statementconfirmed/change_form_object_tools.html:8
msgid "Unconfirm"
msgstr ""
#: templates/admin/finance/statementsubmitted/change_form_object_tools.html:21
msgid "Reduce transactions"
msgstr "Überweisungen minimieren"
#: templates/admin/finance/statementsubmitted/change_form_object_tools.html:36
msgid "Overview"
msgstr "Übersicht"
#: templates/admin/finance/statementunsubmitted/change_form_object_tools.html:9
msgid "Submit"
msgstr "Einreichen"
#: templates/admin/members/freizeit/change_form_object_tools.html:8
msgid "Submit statement"
msgstr "Abrechnung einreichen"
#: templates/admin/members/memberwaitinglist/change_form_object_tools.html:8
#: templates/admin/members/memberwaitinglist/submit_line.html:9
msgid "Invite to group"
msgstr "Zu Gruppe einladen"
#: utils.py:26 #: utils.py:26
msgid "Filetype not supported." msgid "Filetype not supported."
msgstr "Dateityp nicht unterstützt." msgstr "Dateityp nicht unterstützt."

@ -410,14 +410,24 @@ class BillOnStatementInline(admin.TabularInline):
TextField: {'widget': Textarea(attrs={'rows': 1, 'cols': 40})} TextField: {'widget': Textarea(attrs={'rows': 1, 'cols': 40})}
} }
def get_readonly_fields(self, request, obj=None):
if obj is not None and obj.submitted:
return self.fields
return super(BillOnStatementInline, self).get_readonly_fields(request, obj)
class StatementOnListInline(nested_admin.NestedStackedInline): class StatementOnListInline(nested_admin.NestedStackedInline):
model = Statement model = Statement
extra = 1 extra = 1
sortable_options = [] sortable_options = []
fields = ['explanation'] fields = ['night_cost']
inlines = [BillOnStatementInline] inlines = [BillOnStatementInline]
def get_readonly_fields(self, request, obj=None):
if obj is not None and hasattr(obj, 'statement') and obj.statement.submitted:
return self.fields
return super(StatementOnListInline, self).get_readonly_fields(request, obj)
class InterventionOnLJPInline(admin.TabularInline): class InterventionOnLJPInline(admin.TabularInline):
model = Intervention model = Intervention

@ -0,0 +1,14 @@
{% extends "admin/change_form_object_tools.html" %}
{% load i18n admin_urls %}
{% block object-tools-items %}
<li>
{% if original.statement and not original.statement.submitted %}
<a class="historylink" href="{% url 'admin:finance_statementunsubmitted_submit' original.statement.pk %}">{% trans 'Submit statement' %}</a>
{% endif %}
</li>
{{block.super}}
{% endblock %}
Loading…
Cancel
Save