diff --git a/accounting/models.py b/accounting/models.py index 8b0be338..6dbf56d8 100644 --- a/accounting/models.py +++ b/accounting/models.py @@ -218,7 +218,7 @@ class Operation(models.Model): journal = models.ForeignKey(GeneralJournal, related_name="operations", null=False, verbose_name=_("journal")) amount = CurrencyField(_('amount')) date = models.DateField(_('date')) - remark = models.CharField(_('comment'), max_length=128) + remark = models.CharField(_('comment'), max_length=128, default="", null=True, blank=True) mode = models.CharField(_('payment method'), max_length=255, choices=settings.SITH_ACCOUNTING_PAYMENT_METHOD) cheque_number = models.CharField(_('cheque number'), max_length=32, default="", null=True, blank=True) invoice = models.ForeignKey(SithFile, related_name='operations', verbose_name=_("invoice"), null=True, blank=True) diff --git a/accounting/templates/accounting/bank_account_details.jinja b/accounting/templates/accounting/bank_account_details.jinja index 076d2753..95981b1b 100644 --- a/accounting/templates/accounting/bank_account_details.jinja +++ b/accounting/templates/accounting/bank_account_details.jinja @@ -11,7 +11,7 @@


{% trans %}Bank account: {% endtrans %}{{ object.name }}

- {% if user.is_root and not object.club_accounts.exists() %} + {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) and not object.club_accounts.exists() %} {% trans %}Delete{% endtrans %} {% endif %}

{% trans %}Infos{% endtrans %}

@@ -24,6 +24,7 @@ {% for c in object.club_accounts.all() %}
  • {{ c }} - {% trans %}Edit{% endtrans %} + - {% trans %}Delete{% endtrans %}
  • {% endfor %} diff --git a/accounting/templates/accounting/club_account_details.jinja b/accounting/templates/accounting/club_account_details.jinja index 333e3081..2b606a5f 100644 --- a/accounting/templates/accounting/club_account_details.jinja +++ b/accounting/templates/accounting/club_account_details.jinja @@ -15,7 +15,9 @@ {% if user.is_root and not object.journals.exists() %} {% trans %}Delete{% endtrans %} {% endif %} + {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) %}

    {% trans %}New label{% endtrans %}

    + {% endif %}

    {% trans %}Label list{% endtrans %}

    {% if not object.has_open_journal() %}

    {% trans %}New journal{% endtrans %}

    @@ -52,7 +54,11 @@ {% trans %}No{% endtrans %} {% endif %} {% trans %}View{% endtrans %} - {% trans %}Edit{% endtrans %} + {% trans %}Edit{% endtrans %} + {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) %} + {% trans %}Delete{% endtrans %} + {% endif %} + {% endfor %} diff --git a/accounting/templates/accounting/journal_details.jinja b/accounting/templates/accounting/journal_details.jinja index e38dfe7d..6884884d 100644 --- a/accounting/templates/accounting/journal_details.jinja +++ b/accounting/templates/accounting/journal_details.jinja @@ -78,9 +78,11 @@ - {% endif %} + {% if o.journal.club_account.bank_account.name != "AE TI" and journal.club_account.bank_account.name != "TI" or user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) %} {% if not o.journal.closed %} {% trans %}Edit{% endtrans %} {% endif %} + {% endif %} {% trans %}Generate{% endtrans %} diff --git a/accounting/templates/accounting/label_list.jinja b/accounting/templates/accounting/label_list.jinja index 9d35701b..9841fba6 100644 --- a/accounting/templates/accounting/label_list.jinja +++ b/accounting/templates/accounting/label_list.jinja @@ -12,13 +12,18 @@


    {% trans %}Back to club account{% endtrans %}

    + {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) %}

    {% trans %}New label{% endtrans %}

    + {% endif %} {% if object.labels.all() %}

    {% trans %}Label list{% endtrans %}

    diff --git a/accounting/urls.py b/accounting/urls.py index 3255cb9d..2a3727fa 100644 --- a/accounting/urls.py +++ b/accounting/urls.py @@ -26,6 +26,7 @@ urlpatterns = [ url(r'^journal/create$', JournalCreateView.as_view(), name='journal_new'), url(r'^journal/(?P[0-9]+)$', JournalDetailView.as_view(), name='journal_details'), url(r'^journal/(?P[0-9]+)/edit$', JournalEditView.as_view(), name='journal_edit'), + url(r'^journal/(?P[0-9]+)/delete$', JournalDeleteView.as_view(), name='journal_delete'), url(r'^journal/(?P[0-9]+)/statement/nature$', JournalNatureStatementView.as_view(), name='journal_nature_statement'), url(r'^journal/(?P[0-9]+)/statement/person$', JournalPersonStatementView.as_view(), name='journal_person_statement'), url(r'^journal/(?P[0-9]+)/statement/accounting$', JournalAccountingStatementView.as_view(), name='journal_accounting_statement'), diff --git a/accounting/views.py b/accounting/views.py index c50b1f6b..8ea2c3c1 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -230,6 +230,15 @@ class JournalEditView(CanEditMixin, UpdateView): fields = ['name', 'start_date', 'end_date', 'club_account', 'closed'] template_name = 'core/edit.jinja' +class JournalDeleteView(CanEditPropMixin, DeleteView): + """ + Delete a club account (for the admins) + """ + model = GeneralJournal + pk_url_kwarg = "j_id" + template_name = 'core/delete_confirm.jinja' + success_url = reverse_lazy('accounting:club_details') + # Operation views