Improve UX for accounting linked operation

This commit is contained in:
Skia 2016-12-29 01:08:08 +01:00
parent 17b4e24aaa
commit fbb41c3cd5
4 changed files with 81 additions and 35 deletions

View File

@ -62,7 +62,16 @@
{% else %}
<td>{% trans %}No{% endtrans %}</td>
{% endif %}
<td>{{ o.remark }}</td>
<td>{{ o.remark }}
{% if not o.linked_operation and o.target_type == "ACCOUNT" and not o.target.has_open_journal() %}
<p><strong>
{% trans %}Warning: this operation has no linked operation because the targeted club account has no opened journal.{% endtrans %}
</strong></p>
<p><strong>
{% trans url=o.target.get_absolute_url() %}Open a journal in <a href="{{ url }}">this club account</a>, then save this operation again to make the linked operation.{% endtrans %}
</strong></p>
{% endif %}
</td>
{% if o.invoice %}
<td><a href="{{ url('core:download', file_id=o.invoice.id) }}">{{ o.invoice.name }}</a></td>
{% else %}

View File

@ -38,6 +38,16 @@
form.accounting_type }}</p>
<p>{{ form.label.errors }}<label for="{{ form.label.name }}">{{ form.label.label }}</label> {{ form.label }}</p>
<p>{{ form.done.errors }}<label for="{{ form.done.name }}">{{ form.done.label }}</label> {{ form.done }}</p>
{% if form.instance.linked_operation %}
{% set obj = form.instance.linked_operation %}
<p><strong>{% trans %}Linked operation:{% endtrans %}</strong><br>
<a href="{{ url('accounting:bank_details', b_account_id=obj.journal.club_account.bank_account.id) }}">
{{obj.journal.club_account.bank_account }}</a> >
<a href="{{ url('accounting:club_details', c_account_id=obj.journal.club_account.id) }}">{{ obj.journal.club_account }}</a> >
<a href="{{ url('accounting:journal_details', j_id=obj.journal.id) }}">{{ obj.journal }}</a> >
n°{{ obj.number }}
</p>
{% endif %}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
</form>
{% endblock %}

View File

@ -5,7 +5,7 @@ from django.core.urlresolvers import reverse_lazy, reverse
from django.utils.translation import ugettext_lazy as _
from django.forms.models import modelform_factory
from django.core.exceptions import PermissionDenied
from django.forms import HiddenInput
from django.forms import HiddenInput, TextInput
from django.db import transaction
from django.db.models import Sum
from django.conf import settings
@ -237,7 +237,7 @@ class OperationForm(forms.ModelForm):
class Meta:
model = Operation
fields = ['amount', 'remark', 'journal', 'target_type', 'target_id', 'target_label', 'date', 'mode',
'cheque_number', 'invoice', 'simpleaccounting_type', 'accounting_type', 'label', 'done']
'cheque_number', 'invoice', 'simpleaccounting_type', 'accounting_type', 'label', 'done' ]
widgets = {
'journal': HiddenInput,
'target_id': HiddenInput,
@ -281,7 +281,7 @@ class OperationForm(forms.ModelForm):
inst = self.instance
club_account = inst.target
acc_type = AccountingType.objects.exclude(movement_type="NEUTRAL").exclude(
movement_type=inst.accounting_type.movement_type).first() # Select a random opposite accounting type
movement_type=inst.accounting_type.movement_type).order_by('code').first() # Select a random opposite accounting type
op = Operation(
journal=club_account.get_open_journal(),
amount=inst.amount,

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-26 00:34+0100\n"
"POT-Creation-Date: 2016-12-29 01:01+0100\n"
"PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n"
@ -327,7 +327,7 @@ msgstr "Compte en banque : "
#: launderette/templates/launderette/launderette_admin.jinja:16
#: launderette/views.py:154 sas/templates/sas/album.jinja:26
#: sas/templates/sas/moderation.jinja:18 sas/templates/sas/picture.jinja:66
#: sas/templates/sas/picture.jinja.py:116
#: sas/templates/sas/picture.jinja:116
msgid "Delete"
msgstr "Supprimer"
@ -351,11 +351,12 @@ msgstr "Nouveau compte club"
#: accounting/templates/accounting/bank_account_details.jinja:26
#: accounting/templates/accounting/bank_account_list.jinja:21
#: accounting/templates/accounting/club_account_details.jinja:55
#: accounting/templates/accounting/journal_details.jinja:73 club/views.py:54
#: accounting/templates/accounting/journal_details.jinja:82 club/views.py:54
#: com/templates/com/news_admin_list.jinja:39
#: com/templates/com/news_admin_list.jinja:71 core/templates/core/file.jinja:38
#: core/templates/core/page.jinja:31 core/templates/core/user_tools.jinja:38
#: core/views/user.py:152 counter/templates/counter/cash_summary_list.jinja:53
#: com/templates/com/news_admin_list.jinja:71
#: core/templates/core/file.jinja:38 core/templates/core/page.jinja:31
#: core/templates/core/user_tools.jinja:38 core/views/user.py:152
#: counter/templates/counter/cash_summary_list.jinja:53
#: counter/templates/counter/counter_list.jinja:17
#: counter/templates/counter/counter_list.jinja:32
#: counter/templates/counter/counter_list.jinja:47
@ -466,8 +467,8 @@ msgstr "Non"
#: accounting/templates/accounting/club_account_details.jinja:54
#: com/templates/com/news_admin_list.jinja:38
#: com/templates/com/news_admin_list.jinja:70 core/templates/core/file.jinja:36
#: core/templates/core/page.jinja:28
#: com/templates/com/news_admin_list.jinja:70
#: core/templates/core/file.jinja:36 core/templates/core/page.jinja:28
msgid "View"
msgstr "Voir"
@ -570,7 +571,24 @@ msgstr "Fichier"
msgid "PDF"
msgstr "PDF"
#: accounting/templates/accounting/journal_details.jinja:76
#: accounting/templates/accounting/journal_details.jinja:68
msgid ""
"Warning: this operation has no linked operation because the targeted club "
"account has no opened journal."
msgstr ""
"Attention: cette opération n'a pas d'opération liée parce qu'il n'y a pas de "
"classeur ouvert dans le compte club cible"
#: accounting/templates/accounting/journal_details.jinja:71
#, python-format
msgid ""
"Open a journal in <a href=\"%(url)s\">this club account</a>, then save this "
"operation again to make the linked operation."
msgstr ""
"Ouvrez un classeur dans <a href=\"%(url)s\">ce compte club</a>, puis sauver "
"cette opération à nouveau pour créer l'opération liée."
#: accounting/templates/accounting/journal_details.jinja:85
msgid "Generate"
msgstr "Générer"
@ -632,7 +650,11 @@ msgstr "Il n'y a pas d'étiquette dans ce compte club."
msgid "Edit operation"
msgstr "Éditer l'opération"
#: accounting/templates/accounting/operation_edit.jinja:41
#: accounting/templates/accounting/operation_edit.jinja:43
msgid "Linked operation:"
msgstr "Opération liée : "
#: accounting/templates/accounting/operation_edit.jinja:51
#: com/templates/com/news_edit.jinja:66 core/templates/core/create.jinja:12
#: core/templates/core/edit.jinja:7 core/templates/core/edit.jinja.py:15
#: core/templates/core/edit.jinja:20 core/templates/core/file_edit.jinja:8
@ -796,11 +818,12 @@ msgstr "L'utilisateur doit être cotisant pour faire partie d'un club"
msgid "User is already member of that club"
msgstr "L'utilisateur est déjà membre de ce club"
#: club/models.py:166
#: club/models.py:161
msgid "past member"
msgstr "Anciens membres"
#: club/templates/club/club_list.jinja:4 club/templates/club/club_list.jinja:24
#: club/templates/club/club_list.jinja:4
#: club/templates/club/club_list.jinja:24
msgid "Club list"
msgstr "Liste des clubs"
@ -862,8 +885,8 @@ msgstr "Du"
msgid "To"
msgstr "Au"
#: club/templates/club/club_sellings.jinja:5 club/views.py:59 club/views.py:216
#: counter/templates/counter/counter_main.jinja:19
#: club/templates/club/club_sellings.jinja:5 club/views.py:59
#: club/views.py:219 counter/templates/counter/counter_main.jinja:19
#: counter/templates/counter/last_ops.jinja:35
msgid "Sellings"
msgstr "Ventes"
@ -885,7 +908,7 @@ msgstr "Quantité : "
msgid "units"
msgstr "unités"
#: club/templates/club/club_sellings.jinja:20 club/views.py:167
#: club/templates/club/club_sellings.jinja:20 club/views.py:170
#: core/templates/core/user_account_detail.jinja:18
#: core/templates/core/user_account_detail.jinja:51
#: counter/templates/counter/cash_summary_list.jinja:33 counter/views.py:77
@ -975,23 +998,24 @@ msgstr "Outils"
msgid "Props"
msgstr "Propriétés"
#: club/views.py:103 core/views/forms.py:204 counter/views.py:38
#: club/views.py:106 core/views/forms.py:204 counter/views.py:38
msgid "Select user"
msgstr "Choisir un utilisateur"
#: club/views.py:150 sas/views.py:81 sas/views.py:131 sas/views.py:181
#: club/views.py:153 sas/views.py:81 sas/views.py:131 sas/views.py:181
msgid "You do not have the permission to do that"
msgstr "Vous n'avez pas la permission de faire cela"
#: club/views.py:165 counter/views.py:908
#: club/views.py:168 counter/views.py:908
msgid "Begin date"
msgstr "Date de début"
#: club/views.py:166 com/views.py:81 counter/views.py:909 election/views.py:130
#: club/views.py:169 com/views.py:81 counter/views.py:909
#: election/views.py:131
msgid "End date"
msgstr "Date de fin"
#: club/views.py:180 core/templates/core/user_stats.jinja:27
#: club/views.py:183 core/templates/core/user_stats.jinja:27
#: counter/views.py:989
msgid "Product"
msgstr "Produit"
@ -1071,8 +1095,9 @@ msgid "News admin"
msgstr "Administration des nouvelles"
#: com/templates/com/news_admin_list.jinja:9
#: com/templates/com/news_detail.jinja:5 com/templates/com/news_detail.jinja:11
#: com/templates/com/news_list.jinja:4 com/templates/com/news_list.jinja:28
#: com/templates/com/news_detail.jinja:5
#: com/templates/com/news_detail.jinja:11 com/templates/com/news_list.jinja:4
#: com/templates/com/news_list.jinja:28
msgid "News"
msgstr "Nouvelles"
@ -1194,7 +1219,7 @@ msgstr "Message d'info"
msgid "Alert message"
msgstr "Message d'alerte"
#: com/views.py:80 election/views.py:129
#: com/views.py:80 election/views.py:130
msgid "Start date"
msgstr "Date de début"
@ -1910,11 +1935,13 @@ msgstr "login"
msgid "Lost password?"
msgstr "Mot de passe perdu ?"
#: core/templates/core/macros.jinja:27 core/templates/core/user_detail.jinja:27
#: core/templates/core/macros.jinja:27
#: core/templates/core/user_detail.jinja:27
msgid "Born: "
msgstr "Né le : "
#: core/templates/core/macros.jinja:31 core/templates/core/user_detail.jinja:48
#: core/templates/core/macros.jinja:31
#: core/templates/core/user_detail.jinja:48
msgid "Promo: "
msgstr "Promo : "
@ -3196,7 +3223,7 @@ msgstr "Vous avez déjà soumis votre vote."
msgid "You have voted in this election."
msgstr "Vous avez déjà voté pour cette élection."
#: election/templates/election/election_detail.jinja:266 election/views.py:81
#: election/templates/election/election_detail.jinja:266 election/views.py:82
msgid "Blank vote"
msgstr "Vote blanc"
@ -3255,23 +3282,23 @@ msgstr "au"
msgid "Polls open from"
msgstr "Votes ouverts du"
#: election/views.py:43
#: election/views.py:44
msgid "You have selected too much candidates."
msgstr "Vous avez sélectionné trop de candidats."
#: election/views.py:58
#: election/views.py:59
msgid "User to candidate"
msgstr "Utilisateur se présentant"
#: election/views.py:101
#: election/views.py:102
msgid "This role already exists for this election"
msgstr "Ce rôle existe déjà pour cette élection"
#: election/views.py:131
#: election/views.py:132
msgid "Start candidature"
msgstr "Début des candidatures"
#: election/views.py:132
#: election/views.py:133
msgid "End candidature"
msgstr "Fin des candidatures"