Rename bilan to statement

This commit is contained in:
Skia 2016-12-21 05:18:02 +01:00
parent bdcc0bf6e9
commit e6e4929eff
5 changed files with 39 additions and 39 deletions

View File

@ -6,7 +6,7 @@
{% block content %}
<h3>{% trans %}Accounting bilan: {% endtrans %} {{ object.name }}</h3>
<h3>{% trans %}Accounting statement: {% endtrans %} {{ object.name }}</h3>
<table>
<thead>
@ -16,7 +16,7 @@
</tr>
</thead>
<tbody>
{% for k,v in bilan.items() %}
{% for k,v in statement.items() %}
<tr>
<td>{{ k }}</td>
<td>{{ v }}</td>

View File

@ -5,7 +5,7 @@
{% endblock %}
{% macro display_tables(dict) %}
<h4>{% trans %}Credit{% endtrans %}</h4>
<h5>{% trans %}Credit{% endtrans %}</h5>
<table>
<thead>
<tr>
@ -24,7 +24,7 @@
</table>
{% trans %}Total: {% endtrans %}{{ dict['CREDIT_sum'] }}
<h4>{% trans %}Debit{% endtrans %}</h4>
<h5>{% trans %}Debit{% endtrans %}</h5>
<table>
<thead>
<tr>
@ -45,10 +45,10 @@
{% endmacro %}
{% block content %}
<h2>{% trans %}Statement by nature: {% endtrans %} {{ object.name }}</h2>
<h3>{% trans %}Statement by nature: {% endtrans %} {{ object.name }}</h3>
{% for k,v in statement.items() %}
<h3>{{ k }}</h3>
<h4>{{ k }}</h4>
{{ display_tables(v) }}
<hr>
{% endfor %}

View File

@ -6,9 +6,9 @@
{% block content %}
<h2>{% trans %}Person bilan: {% endtrans %} {{ object.name }}</h2>
<h3>{% trans %}Statement by person: {% endtrans %} {{ object.name }}</h3>
<h3>{% trans %}Credit{% endtrans %}</h3>
<h4>{% trans %}Credit{% endtrans %}</h4>
<table>
<thead>
@ -18,14 +18,14 @@
</tr>
</thead>
<tbody>
{% for key in bilan_credit.keys() %}
{% for key in credit_statement.keys() %}
<tr>
{% if key.target_type == "OTHER" %}
<td>{{ o.target_label }}</td>
{% else %}
<td><a href="{{ key.get_absolute_url() }}">{{ key.get_display_name() }}</a></td>
{% endif %}
<td>{{bilan_credit[key]}}</td>
<td>{{credit_statement[key]}}</td>
</tr>
{% endfor %}
</tbody>
@ -34,8 +34,8 @@
<p>Total : {{total_credit}}</p>
<h3>{% trans %}Debit{% endtrans %}</h3>
<h4>{% trans %}Debit{% endtrans %}</h4>
<table>
<thead>
<tr>
@ -44,14 +44,14 @@
</tr>
</thead>
<tbody>
{% for key in bilan_debit.keys() %}
{% for key in debit_statement.keys() %}
<tr>
{% if key.target_type == "OTHER" %}
<td>{{ o.target_label }}</td>
{% else %}
<td><a href="{{ key.get_absolute_url() }}">{{ key.get_display_name() }}</a></td>
{% endif %}
<td>{{bilan_debit[key]}}</td>
<td>{{debit_statement[key]}}</td>
</tr>
{% endfor %}
</tbody>
@ -60,4 +60,4 @@
<p>Total : {{total_debit}}</p>
{% endblock %}
{% endblock %}

View File

@ -26,9 +26,9 @@ urlpatterns = [
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]+)/edit$', JournalEditView.as_view(), name='journal_edit'),
url(r'^journal/(?P<j_id>[0-9]+)/bilan/nature$', JournalBilanNatureView.as_view(), name='journal_bilan_nature'),
url(r'^journal/(?P<j_id>[0-9]+)/bilan/person$', JournalBilanPersonView.as_view(), name='journal_bilan_person'),
url(r'^journal/(?P<j_id>[0-9]+)/bilan/accounting$', JournalBilanAccountingView.as_view(), name='journal_bilan_accounting'),
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/accounting$', JournalAccountingStatementView.as_view(), name='journal_accounting_statement'),
# Operations
url(r'^operation/create/(?P<j_id>[0-9]+)$', OperationCreateView.as_view(), name='op_new'),

View File

@ -179,19 +179,19 @@ class JournalTabsMixin(TabedViewMixin):
'name': _("Journal"),
})
tab_list.append({
'url': reverse('accounting:journal_bilan_nature', kwargs={'j_id': self.object.id}),
'slug': 'bilan_nature',
'name': _("Bilan nature"),
'url': reverse('accounting:journal_nature_statement', kwargs={'j_id': self.object.id}),
'slug': 'nature_statement',
'name': _("Statement by nature"),
})
tab_list.append({
'url': reverse('accounting:journal_bilan_person', kwargs={'j_id': self.object.id}),
'slug': 'bilan_person',
'name': _("Bilan person"),
'url': reverse('accounting:journal_person_statement', kwargs={'j_id': self.object.id}),
'slug': 'person_statement',
'name': _("Statement by person"),
})
tab_list.append({
'url': reverse('accounting:journal_bilan_accounting', kwargs={'j_id': self.object.id}),
'slug': 'bilan_accounting',
'name': _("Bilan accounting"),
'url': reverse('accounting:journal_accounting_statement', kwargs={'j_id': self.object.id}),
'slug': 'accounting_statement',
'name': _("Accounting statement"),
})
return tab_list
@ -470,14 +470,14 @@ class OperationPDFView(CanViewMixin, DetailView):
p.save()
return response
class JournalBilanNatureView(JournalTabsMixin, CanViewMixin, DetailView):
class JournalNatureStatementView(JournalTabsMixin, CanViewMixin, DetailView):
"""
Display a statement sorted by labels
"""
model = GeneralJournal
pk_url_kwarg = "j_id"
template_name='accounting/journal_bilan_nature.jinja'
current_tab='bilan_nature'
template_name='accounting/journal_statement_nature.jinja'
current_tab='nature_statement'
def statement(self, queryset, movement_type):
ret = collections.OrderedDict()
@ -514,18 +514,18 @@ class JournalBilanNatureView(JournalTabsMixin, CanViewMixin, DetailView):
def get_context_data(self, **kwargs):
""" Add infos to the context """
kwargs = super(JournalBilanNatureView, self).get_context_data(**kwargs)
kwargs = super(JournalNatureStatementView, self).get_context_data(**kwargs)
kwargs['statement'] = self.big_statement()
return kwargs
class JournalBilanPersonView(JournalTabsMixin, CanViewMixin, DetailView):
class JournalPersonStatementView(JournalTabsMixin, CanViewMixin, DetailView):
"""
Calculate a dictionary with operation target and sum of operations
"""
model = GeneralJournal
pk_url_kwarg = "j_id"
template_name='accounting/journal_bilan_person.jinja'
current_tab='bilan_person'
template_name='accounting/journal_statement_person.jinja'
current_tab='person_statement'
def sum_by_target(self, target_id):
from decimal import Decimal
@ -553,21 +553,21 @@ class JournalBilanPersonView(JournalTabsMixin, CanViewMixin, DetailView):
def get_context_data(self, **kwargs):
""" Add journal to the context """
kwargs = super(JournalBilanPersonView, self).get_context_data(**kwargs)
kwargs = super(JournalPersonStatementView, self).get_context_data(**kwargs)
kwargs['credit_statement'] = self.credit_statement()
kwargs['debit_statement'] = self.debit_statement()
kwargs['total_credit'] = self.total_credit()
kwargs['total_debit'] = self.total_debit()
return kwargs
class JournalBilanAccountingView(JournalTabsMixin, CanViewMixin, DetailView):
class JournalAccountingStatementView(JournalTabsMixin, CanViewMixin, DetailView):
"""
Calculate a dictionary with operation type and sum of operations
"""
model = GeneralJournal
pk_url_kwarg = "j_id"
template_name='accounting/journal_bilan_accounting.jinja'
current_tab = "bilan_accounting"
template_name='accounting/journal_statement_accounting.jinja'
current_tab = "accounting_statement"
def statement(self):
statement = collections.OrderedDict()
@ -580,7 +580,7 @@ class JournalBilanAccountingView(JournalTabsMixin, CanViewMixin, DetailView):
def get_context_data(self, **kwargs):
""" Add journal to the context """
kwargs = super(JournalBilanAccountingView, self).get_context_data(**kwargs)
kwargs = super(JournalAccountingStatementView, self).get_context_data(**kwargs)
kwargs['statement'] = self.statement()
return kwargs