Management for companies added

This commit is contained in:
Pierre Brunet 2016-12-19 21:58:40 +01:00
parent 397778af1c
commit c372b22197
6 changed files with 261 additions and 209 deletions

View File

@ -0,0 +1,26 @@
{% extends "core/base.jinja" %}
{% block title %}
{% trans %}Company list{% endtrans %}
{% endblock %}
{% block content %}
<p><a href="{{ url('accounting:co_new') }}">{% trans %}Create new company{% endtrans %}</a></p>
</br>
<table>
<thead>
<tr>
<td>{% trans %}Companies{% endtrans %}</td>
</tr>
</thead>
<tbody>
{% for o in object_list %}
<tr>
<td><a href="{{ url('accounting:co_edit', co_id=o.id) }}">{{ o.get_display_name() }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@ -15,6 +15,7 @@
<h2>{% trans %}General journal:{% endtrans %} {{ object.name }}</h2> <h2>{% trans %}General journal:{% endtrans %} {{ object.name }}</h2>
<p><a href="{{ url('accounting:label_new') }}?parent={{ object.club_account.id }}">{% trans %}New label{% endtrans %}</a></p> <p><a href="{{ url('accounting:label_new') }}?parent={{ object.club_account.id }}">{% trans %}New label{% endtrans %}</a></p>
<p><a href="{{ url('accounting:label_list', clubaccount_id=object.club_account.id) }}">{% trans %}Label list{% endtrans %}</a></p> <p><a href="{{ url('accounting:label_list', clubaccount_id=object.club_account.id) }}">{% trans %}Label list{% endtrans %}</a></p>
<p><a href="{{ url('accounting:co_list') }}">{% trans %}Company list{% endtrans %}</a></p>
<p><strong>{% trans %}Amount: {% endtrans %}</strong>{{ object.amount }} € - <p><strong>{% trans %}Amount: {% endtrans %}</strong>{{ object.amount }} € -
<strong>{% trans %}Effective amount: {% endtrans %}</strong>{{ object.effective_amount }} €</p> <strong>{% trans %}Effective amount: {% endtrans %}</strong>{{ object.effective_amount }} €</p>
{% if object.closed %} {% if object.closed %}

View File

@ -31,6 +31,7 @@ urlpatterns = [
url(r'^operation/(?P<op_id>[0-9]+)$', OperationEditView.as_view(), name='op_edit'), url(r'^operation/(?P<op_id>[0-9]+)$', OperationEditView.as_view(), name='op_edit'),
url(r'^operation/(?P<op_id>[0-9]+)/pdf$', OperationPDFView.as_view(), name='op_pdf'), url(r'^operation/(?P<op_id>[0-9]+)/pdf$', OperationPDFView.as_view(), name='op_pdf'),
# Companies # Companies
url(r'^company/list$', CompanyListView.as_view(), name='co_list'),
url(r'^company/create$', CompanyCreateView.as_view(), name='co_new'), url(r'^company/create$', CompanyCreateView.as_view(), name='co_new'),
url(r'^company/(?P<co_id>[0-9]+)$', CompanyEditView.as_view(), name='co_edit'), url(r'^company/(?P<co_id>[0-9]+)$', CompanyEditView.as_view(), name='co_edit'),
# Labels # Labels

View File

@ -446,6 +446,10 @@ class OperationPDFView(CanViewMixin, DetailView):
# Company views # Company views
class CompanyListView(CanViewMixin, ListView):
model = Company
template_name = 'accounting/co_list.jinja'
class CompanyCreateView(CanCreateMixin, CreateView): class CompanyCreateView(CanCreateMixin, CreateView):
""" """
Create a company Create a company
@ -453,6 +457,8 @@ class CompanyCreateView(CanCreateMixin, CreateView):
model = Company model = Company
fields = ['name'] fields = ['name']
template_name = 'core/create.jinja' template_name = 'core/create.jinja'
success_url = reverse_lazy('accounting:co_list')
class CompanyEditView(CanCreateMixin, UpdateView): class CompanyEditView(CanCreateMixin, UpdateView):
""" """
@ -462,6 +468,7 @@ class CompanyEditView(CanCreateMixin, UpdateView):
pk_url_kwarg = "co_id" pk_url_kwarg = "co_id"
fields = ['name'] fields = ['name']
template_name = 'core/edit.jinja' template_name = 'core/edit.jinja'
success_url = reverse_lazy('accounting:co_list')
# Label views # Label views

View File

@ -47,6 +47,7 @@
{% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) or user.is_root %} {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) or user.is_root %}
<li><a href="{{ url('accounting:refound_account') }}">{% trans %}Refound Account{% endtrans %}</a></li> <li><a href="{{ url('accounting:refound_account') }}">{% trans %}Refound Account{% endtrans %}</a></li>
<li><a href="{{ url('accounting:bank_list') }}">{% trans %}General accounting{% endtrans %}</a></li> <li><a href="{{ url('accounting:bank_list') }}">{% trans %}General accounting{% endtrans %}</a></li>
<li><a href="{{ url('accounting:co_list') }}">{% trans %}Company list{% endtrans %}</a></li>
{% endif %} {% endif %}
{% for m in user.memberships.filter(end_date=None).filter(role__gte=7).all() -%} {% for m in user.memberships.filter(end_date=None).filter(role__gte=7).all() -%}
{%- for b in m.club.bank_accounts.all() %} {%- for b in m.club.bank_accounts.all() %}

File diff suppressed because it is too large Load Diff