mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-11-04 11:03:04 +00:00 
			
		
		
		
	Several modifications in accounting
This commit is contained in:
		@@ -218,7 +218,7 @@ class Operation(models.Model):
 | 
				
			|||||||
    journal = models.ForeignKey(GeneralJournal, related_name="operations", null=False, verbose_name=_("journal"))
 | 
					    journal = models.ForeignKey(GeneralJournal, related_name="operations", null=False, verbose_name=_("journal"))
 | 
				
			||||||
    amount = CurrencyField(_('amount'))
 | 
					    amount = CurrencyField(_('amount'))
 | 
				
			||||||
    date = models.DateField(_('date'))
 | 
					    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)
 | 
					    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)
 | 
					    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)
 | 
					    invoice = models.ForeignKey(SithFile, related_name='operations', verbose_name=_("invoice"), null=True, blank=True)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@
 | 
				
			|||||||
    </p>
 | 
					    </p>
 | 
				
			||||||
    <hr>
 | 
					    <hr>
 | 
				
			||||||
    <h2>{% trans %}Bank account: {% endtrans %}{{ object.name }}</h2>
 | 
					    <h2>{% trans %}Bank account: {% endtrans %}{{ object.name }}</h2>
 | 
				
			||||||
    {% 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() %}
 | 
				
			||||||
    <a href="{{ url('accounting:bank_delete', b_account_id=object.id) }}">{% trans %}Delete{% endtrans %}</a>
 | 
					    <a href="{{ url('accounting:bank_delete', b_account_id=object.id) }}">{% trans %}Delete{% endtrans %}</a>
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
    <h4>{% trans %}Infos{% endtrans %}</h4>
 | 
					    <h4>{% trans %}Infos{% endtrans %}</h4>
 | 
				
			||||||
@@ -24,6 +24,7 @@
 | 
				
			|||||||
    {% for c in object.club_accounts.all() %}
 | 
					    {% for c in object.club_accounts.all() %}
 | 
				
			||||||
        <li><a href="{{ url('accounting:club_details', c_account_id=c.id) }}">{{ c }}</a>
 | 
					        <li><a href="{{ url('accounting:club_details', c_account_id=c.id) }}">{{ c }}</a>
 | 
				
			||||||
            - <a href="{{ url('accounting:club_edit', c_account_id=c.id) }}">{% trans %}Edit{% endtrans %}</a>
 | 
					            - <a href="{{ url('accounting:club_edit', c_account_id=c.id) }}">{% trans %}Edit{% endtrans %}</a>
 | 
				
			||||||
 | 
					            - <a href="{{ url('accounting:club_delete', c_account_id=c.id) }}">{% trans %}Delete{% endtrans %}</a>
 | 
				
			||||||
            </li>
 | 
					            </li>
 | 
				
			||||||
    {% endfor %}
 | 
					    {% endfor %}
 | 
				
			||||||
    </ul>
 | 
					    </ul>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,9 @@
 | 
				
			|||||||
    {% if user.is_root and not object.journals.exists() %}
 | 
					    {% if user.is_root and not object.journals.exists() %}
 | 
				
			||||||
    <a href="{{ url('accounting:club_delete', c_account_id=object.id) }}">{% trans %}Delete{% endtrans %}</a>
 | 
					    <a href="{{ url('accounting:club_delete', c_account_id=object.id) }}">{% trans %}Delete{% endtrans %}</a>
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
 | 
					    {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) %}
 | 
				
			||||||
    <p><a href="{{ url('accounting:label_new') }}?parent={{ object.id }}">{% trans %}New label{% endtrans %}</a></p>
 | 
					    <p><a href="{{ url('accounting:label_new') }}?parent={{ object.id }}">{% trans %}New label{% endtrans %}</a></p>
 | 
				
			||||||
 | 
					    {% endif %}
 | 
				
			||||||
    <p><a href="{{ url('accounting:label_list', clubaccount_id=object.id) }}">{% trans %}Label list{% endtrans %}</a></p>
 | 
					    <p><a href="{{ url('accounting:label_list', clubaccount_id=object.id) }}">{% trans %}Label list{% endtrans %}</a></p>
 | 
				
			||||||
    {% if not object.has_open_journal() %}
 | 
					    {% if not object.has_open_journal() %}
 | 
				
			||||||
    <p><a href="{{ url('accounting:journal_new') }}?parent={{ object.id }}">{% trans %}New journal{% endtrans %}</a></p>
 | 
					    <p><a href="{{ url('accounting:journal_new') }}?parent={{ object.id }}">{% trans %}New journal{% endtrans %}</a></p>
 | 
				
			||||||
@@ -52,7 +54,11 @@
 | 
				
			|||||||
            <td>{% trans %}No{% endtrans %}</td>
 | 
					            <td>{% trans %}No{% endtrans %}</td>
 | 
				
			||||||
            {% endif %}
 | 
					            {% endif %}
 | 
				
			||||||
            <td> <a href="{{ url('accounting:journal_details', j_id=j.id) }}">{% trans %}View{% endtrans %}</a>
 | 
					            <td> <a href="{{ url('accounting:journal_details', j_id=j.id) }}">{% trans %}View{% endtrans %}</a>
 | 
				
			||||||
                <a href="{{ url('accounting:journal_edit', j_id=j.id) }}">{% trans %}Edit{% endtrans %}</a> </td>
 | 
					                <a href="{{ url('accounting:journal_edit', j_id=j.id) }}">{% trans %}Edit{% endtrans %}</a>
 | 
				
			||||||
 | 
					                {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) %}
 | 
				
			||||||
 | 
					                    <a href="{{ url('accounting:journal_delete', j_id=j.id) }}">{% trans %}Delete{% endtrans %}</a>
 | 
				
			||||||
 | 
					                {% endif %}
 | 
				
			||||||
 | 
					                </td>
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
        {% endfor %}
 | 
					        {% endfor %}
 | 
				
			||||||
        </tbody>
 | 
					        </tbody>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,9 +78,11 @@
 | 
				
			|||||||
            <td>-</td>
 | 
					            <td>-</td>
 | 
				
			||||||
            {% endif %}
 | 
					            {% endif %}
 | 
				
			||||||
            <td>
 | 
					            <td>
 | 
				
			||||||
 | 
					                {% 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 %}
 | 
					                {% if not o.journal.closed %}
 | 
				
			||||||
                <a href="{{ url('accounting:op_edit', op_id=o.id) }}">{% trans %}Edit{% endtrans %}</a>
 | 
					                <a href="{{ url('accounting:op_edit', op_id=o.id) }}">{% trans %}Edit{% endtrans %}</a>
 | 
				
			||||||
                {% endif %}
 | 
					                {% endif %}
 | 
				
			||||||
 | 
					                {% endif %}
 | 
				
			||||||
            </td>
 | 
					            </td>
 | 
				
			||||||
            <td><a href="{{ url('accounting:op_pdf', op_id=o.id) }}">{% trans %}Generate{% endtrans %}</a></td>
 | 
					            <td><a href="{{ url('accounting:op_pdf', op_id=o.id) }}">{% trans %}Generate{% endtrans %}</a></td>
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,13 +12,18 @@
 | 
				
			|||||||
    </p>
 | 
					    </p>
 | 
				
			||||||
    <hr>
 | 
					    <hr>
 | 
				
			||||||
    <p><a href="{{ url('accounting:club_details', c_account_id=object.id) }}">{% trans %}Back to club account{% endtrans %}</a></p>
 | 
					    <p><a href="{{ url('accounting:club_details', c_account_id=object.id) }}">{% trans %}Back to club account{% endtrans %}</a></p>
 | 
				
			||||||
 | 
					    {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) %}
 | 
				
			||||||
    <p><a href="{{ url('accounting:label_new') }}?parent={{ object.id }}">{% trans %}New label{% endtrans %}</a></p>
 | 
					    <p><a href="{{ url('accounting:label_new') }}?parent={{ object.id }}">{% trans %}New label{% endtrans %}</a></p>
 | 
				
			||||||
 | 
					    {% endif %}
 | 
				
			||||||
    {% if object.labels.all() %}
 | 
					    {% if object.labels.all() %}
 | 
				
			||||||
    <h3>{% trans %}Label list{% endtrans %}</h3>
 | 
					    <h3>{% trans %}Label list{% endtrans %}</h3>
 | 
				
			||||||
    <ul>
 | 
					    <ul>
 | 
				
			||||||
        {% for l in object.labels.all()  %}
 | 
					        {% for l in object.labels.all()  %}
 | 
				
			||||||
        <li><a href="{{ url('accounting:label_edit', label_id=l.id) }}">{{ l }}</a> -
 | 
					        <li><a href="{{ url('accounting:label_edit', label_id=l.id) }}">{{ l }}</a>
 | 
				
			||||||
 | 
					        {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) %}
 | 
				
			||||||
 | 
					         -
 | 
				
			||||||
            <a href="{{ url('accounting:label_delete', label_id=l.id) }}">{% trans %}Delete{% endtrans %}</a>
 | 
					            <a href="{{ url('accounting:label_delete', label_id=l.id) }}">{% trans %}Delete{% endtrans %}</a>
 | 
				
			||||||
 | 
					        {% endif %}
 | 
				
			||||||
        </li>
 | 
					        </li>
 | 
				
			||||||
        {% endfor %}
 | 
					        {% endfor %}
 | 
				
			||||||
    </ul>
 | 
					    </ul>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,6 +26,7 @@ urlpatterns = [
 | 
				
			|||||||
    url(r'^journal/create$', JournalCreateView.as_view(), name='journal_new'),
 | 
					    url(r'^journal/create$', JournalCreateView.as_view(), name='journal_new'),
 | 
				
			||||||
    url(r'^journal/(?P<j_id>[0-9]+)$', JournalDetailView.as_view(), name='journal_details'),
 | 
					    url(r'^journal/(?P<j_id>[0-9]+)$', JournalDetailView.as_view(), name='journal_details'),
 | 
				
			||||||
    url(r'^journal/(?P<j_id>[0-9]+)/edit$', JournalEditView.as_view(), name='journal_edit'),
 | 
					    url(r'^journal/(?P<j_id>[0-9]+)/edit$', JournalEditView.as_view(), name='journal_edit'),
 | 
				
			||||||
 | 
					    url(r'^journal/(?P<j_id>[0-9]+)/delete$', JournalDeleteView.as_view(), name='journal_delete'),
 | 
				
			||||||
    url(r'^journal/(?P<j_id>[0-9]+)/statement/nature$', JournalNatureStatementView.as_view(), name='journal_nature_statement'),
 | 
					    url(r'^journal/(?P<j_id>[0-9]+)/statement/nature$', JournalNatureStatementView.as_view(), name='journal_nature_statement'),
 | 
				
			||||||
    url(r'^journal/(?P<j_id>[0-9]+)/statement/person$', JournalPersonStatementView.as_view(), name='journal_person_statement'),
 | 
					    url(r'^journal/(?P<j_id>[0-9]+)/statement/person$', JournalPersonStatementView.as_view(), name='journal_person_statement'),
 | 
				
			||||||
    url(r'^journal/(?P<j_id>[0-9]+)/statement/accounting$', JournalAccountingStatementView.as_view(), name='journal_accounting_statement'),
 | 
					    url(r'^journal/(?P<j_id>[0-9]+)/statement/accounting$', JournalAccountingStatementView.as_view(), name='journal_accounting_statement'),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -230,6 +230,15 @@ class JournalEditView(CanEditMixin, UpdateView):
 | 
				
			|||||||
    fields = ['name', 'start_date', 'end_date', 'club_account', 'closed']
 | 
					    fields = ['name', 'start_date', 'end_date', 'club_account', 'closed']
 | 
				
			||||||
    template_name = 'core/edit.jinja'
 | 
					    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
 | 
					# Operation views
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user