Commit fbb41c3c authored by Skia's avatar Skia
Browse files

Improve UX for accounting linked operation

parent 17b4e24a
Pipeline #661 failed with stage
in 3 minutes and 16 seconds
...@@ -62,7 +62,16 @@ ...@@ -62,7 +62,16 @@
{% else %} {% else %}
<td>{% trans %}No{% endtrans %}</td> <td>{% trans %}No{% endtrans %}</td>
{% endif %} {% 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 %} {% if o.invoice %}
<td><a href="{{ url('core:download', file_id=o.invoice.id) }}">{{ o.invoice.name }}</a></td> <td><a href="{{ url('core:download', file_id=o.invoice.id) }}">{{ o.invoice.name }}</a></td>
{% else %} {% else %}
......
...@@ -38,6 +38,16 @@ ...@@ -38,6 +38,16 @@
form.accounting_type }}</p> form.accounting_type }}</p>
<p>{{ form.label.errors }}<label for="{{ form.label.name }}">{{ form.label.label }}</label> {{ form.label }}</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> <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> >
{{ obj.number }}
</p>
{% endif %}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p> <p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
</form> </form>
{% endblock %} {% endblock %}
......
...@@ -5,7 +5,7 @@ from django.core.urlresolvers import reverse_lazy, reverse ...@@ -5,7 +5,7 @@ from django.core.urlresolvers import reverse_lazy, reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.forms.models import modelform_factory from django.forms.models import modelform_factory
from django.core.exceptions import PermissionDenied 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 import transaction
from django.db.models import Sum from django.db.models import Sum
from django.conf import settings from django.conf import settings
...@@ -237,7 +237,7 @@ class OperationForm(forms.ModelForm): ...@@ -237,7 +237,7 @@ class OperationForm(forms.ModelForm):
class Meta: class Meta:
model = Operation model = Operation
fields = ['amount', 'remark', 'journal', 'target_type', 'target_id', 'target_label', 'date', 'mode', 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 = { widgets = {
'journal': HiddenInput, 'journal': HiddenInput,
'target_id': HiddenInput, 'target_id': HiddenInput,
...@@ -281,7 +281,7 @@ class OperationForm(forms.ModelForm): ...@@ -281,7 +281,7 @@ class OperationForm(forms.ModelForm):
inst = self.instance inst = self.instance
club_account = inst.target club_account = inst.target
acc_type = AccountingType.objects.exclude(movement_type="NEUTRAL").exclude( 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( op = Operation(
journal=club_account.get_open_journal(), journal=club_account.get_open_journal(),
amount=inst.amount, amount=inst.amount,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "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" "PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n" "Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n" "Language-Team: AE info <ae.info@utbm.fr>\n"
...@@ -327,7 +327,7 @@ msgstr "Compte en banque : " ...@@ -327,7 +327,7 @@ msgstr "Compte en banque : "
#: launderette/templates/launderette/launderette_admin.jinja:16 #: launderette/templates/launderette/launderette_admin.jinja:16
#: launderette/views.py:154 sas/templates/sas/album.jinja:26 #: 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/moderation.jinja:18 sas/templates/sas/picture.jinja:66
#: sas/templates/sas/picture.jinja.py:116 #: sas/templates/sas/picture.jinja:116
msgid "Delete" msgid "Delete"
msgstr "Supprimer" msgstr "Supprimer"
...@@ -351,11 +351,12 @@ msgstr "Nouveau compte club" ...@@ -351,11 +351,12 @@ msgstr "Nouveau compte club"
#: accounting/templates/accounting/bank_account_details.jinja:26 #: accounting/templates/accounting/bank_account_details.jinja:26
#: accounting/templates/accounting/bank_account_list.jinja:21 #: accounting/templates/accounting/bank_account_list.jinja:21
#: accounting/templates/accounting/club_account_details.jinja:55 #: 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:39
#: com/templates/com/news_admin_list.jinja:71 core/templates/core/file.jinja:38 #: com/templates/com/news_admin_list.jinja:71
#: core/templates/core/page.jinja:31 core/templates/core/user_tools.jinja:38 #: core/templates/core/file.jinja:38 core/templates/core/page.jinja:31
#: core/views/user.py:152 counter/templates/counter/cash_summary_list.jinja:53 #: 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:17
#: counter/templates/counter/counter_list.jinja:32 #: counter/templates/counter/counter_list.jinja:32
#: counter/templates/counter/counter_list.jinja:47 #: counter/templates/counter/counter_list.jinja:47
...@@ -466,8 +467,8 @@ msgstr "Non" ...@@ -466,8 +467,8 @@ msgstr "Non"
#: accounting/templates/accounting/club_account_details.jinja:54 #: accounting/templates/accounting/club_account_details.jinja:54
#: com/templates/com/news_admin_list.jinja:38 #: com/templates/com/news_admin_list.jinja:38
#: com/templates/com/news_admin_list.jinja:70 core/templates/core/file.jinja:36 #: com/templates/com/news_admin_list.jinja:70
#: core/templates/core/page.jinja:28 #: core/templates/core/file.jinja:36 core/templates/core/page.jinja:28
msgid "View" msgid "View"
msgstr "Voir" msgstr "Voir"
...@@ -570,7 +571,24 @@ msgstr "Fichier" ...@@ -570,7 +571,24 @@ msgstr "Fichier"
msgid "PDF" msgid "PDF"
msgstr "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" msgid "Generate"
msgstr "Générer" msgstr "Générer"
...@@ -632,7 +650,11 @@ msgstr "Il n'y a pas d'étiquette dans ce compte club." ...@@ -632,7 +650,11 @@ msgstr "Il n'y a pas d'étiquette dans ce compte club."
msgid "Edit operation" msgid "Edit operation"
msgstr "Éditer l'opération" 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 #: 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:7 core/templates/core/edit.jinja.py:15
#: core/templates/core/edit.jinja:20 core/templates/core/file_edit.jinja:8 #: 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" ...@@ -796,11 +818,12 @@ msgstr "L'utilisateur doit être cotisant pour faire partie d'un club"
msgid "User is already member of that club" msgid "User is already member of that club"
msgstr "L'utilisateur est déjà membre de ce club" msgstr "L'utilisateur est déjà membre de ce club"
#: club/models.py:166 #: club/models.py:161
msgid "past member" msgid "past member"
msgstr "Anciens membres" 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" msgid "Club list"
msgstr "Liste des clubs" msgstr "Liste des clubs"
...@@ -862,8 +885,8 @@ msgstr "Du" ...@@ -862,8 +885,8 @@ msgstr "Du"
msgid "To" msgid "To"
msgstr "Au" msgstr "Au"
#: club/templates/club/club_sellings.jinja:5 club/views.py:59 club/views.py:216 #: club/templates/club/club_sellings.jinja:5 club/views.py:59
#: counter/templates/counter/counter_main.jinja:19 #: club/views.py:219 counter/templates/counter/counter_main.jinja:19
#: counter/templates/counter/last_ops.jinja:35 #: counter/templates/counter/last_ops.jinja:35
msgid "Sellings" msgid "Sellings"
msgstr "Ventes" msgstr "Ventes"
...@@ -885,7 +908,7 @@ msgstr "Quantité : " ...@@ -885,7 +908,7 @@ msgstr "Quantité : "
msgid "units" msgid "units"
msgstr "unités" 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:18
#: core/templates/core/user_account_detail.jinja:51 #: core/templates/core/user_account_detail.jinja:51
#: counter/templates/counter/cash_summary_list.jinja:33 counter/views.py:77 #: counter/templates/counter/cash_summary_list.jinja:33 counter/views.py:77
...@@ -975,23 +998,24 @@ msgstr "Outils" ...@@ -975,23 +998,24 @@ msgstr "Outils"
msgid "Props" msgid "Props"
msgstr "Propriétés" 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" msgid "Select user"
msgstr "Choisir un utilisateur" 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" msgid "You do not have the permission to do that"
msgstr "Vous n'avez pas la permission de faire cela" 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" msgid "Begin date"
msgstr "Date de début" 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" msgid "End date"
msgstr "Date de fin" 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 #: counter/views.py:989
msgid "Product" msgid "Product"
msgstr "Produit" msgstr "Produit"
...@@ -1071,8 +1095,9 @@ msgid "News admin" ...@@ -1071,8 +1095,9 @@ msgid "News admin"
msgstr "Administration des nouvelles" msgstr "Administration des nouvelles"
#: com/templates/com/news_admin_list.jinja:9 #: 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_detail.jinja:5
#: com/templates/com/news_list.jinja:4 com/templates/com/news_list.jinja:28 #: com/templates/com/news_detail.jinja:11 com/templates/com/news_list.jinja:4
#: com/templates/com/news_list.jinja:28
msgid "News" msgid "News"
msgstr "Nouvelles" msgstr "Nouvelles"
...@@ -1194,7 +1219,7 @@ msgstr "Message d'info" ...@@ -1194,7 +1219,7 @@ msgstr "Message d'info"
msgid "Alert message" msgid "Alert message"
msgstr "Message d'alerte" msgstr "Message d'alerte"
#: com/views.py:80 election/views.py:129 #: com/views.py:80 election/views.py:130
msgid "Start date" msgid "Start date"
msgstr "Date de début" msgstr "Date de début"
...@@ -1910,11 +1935,13 @@ msgstr "login" ...@@ -1910,11 +1935,13 @@ msgstr "login"
msgid "Lost password?" msgid "Lost password?"
msgstr "Mot de passe perdu ?" 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: " msgid "Born: "
msgstr "Né le : " 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: " msgid "Promo: "
msgstr "Promo : " msgstr "Promo : "
...@@ -3196,7 +3223,7 @@ msgstr "Vous avez déjà soumis votre vote." ...@@ -3196,7 +3223,7 @@ msgstr "Vous avez déjà soumis votre vote."
msgid "You have voted in this election." msgid "You have voted in this election."
msgstr "Vous avez déjà voté pour cette élection." 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" msgid "Blank vote"
msgstr "Vote blanc" msgstr "Vote blanc"
...@@ -3255,23 +3282,23 @@ msgstr "au" ...@@ -3255,23 +3282,23 @@ msgstr "au"
msgid "Polls open from" msgid "Polls open from"
msgstr "Votes ouverts du" msgstr "Votes ouverts du"
#: election/views.py:43 #: election/views.py:44
msgid "You have selected too much candidates." msgid "You have selected too much candidates."
msgstr "Vous avez sélectionné trop de candidats." msgstr "Vous avez sélectionné trop de candidats."
#: election/views.py:58 #: election/views.py:59
msgid "User to candidate" msgid "User to candidate"
msgstr "Utilisateur se présentant" msgstr "Utilisateur se présentant"
#: election/views.py:101 #: election/views.py:102
msgid "This role already exists for this election" msgid "This role already exists for this election"
msgstr "Ce rôle existe déjà pour cette élection" msgstr "Ce rôle existe déjà pour cette élection"
#: election/views.py:131 #: election/views.py:132
msgid "Start candidature" msgid "Start candidature"
msgstr "Début des candidatures" msgstr "Début des candidatures"
#: election/views.py:132 #: election/views.py:133
msgid "End candidature" msgid "End candidature"
msgstr "Fin des candidatures" msgstr "Fin des candidatures"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment