Commit 5fb57e97 authored by Krophil's avatar Krophil
Browse files

Add possibility to not link an operation

parent cd4b0d8e
Pipeline #1373 passed with stage
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
{{ form.club_account }} {{ form.club_account }}
{{ form.company }} {{ form.company }}
{{ form.target_label }} {{ form.target_label }}
<span id="id_need_link_full"><label>{{ form.need_link.label }}</label> {{ form.need_link }}</span>
<p>{{ form.date.errors }}<label for="{{ form.date.name }}">{{ form.date.label }}</label> {{ form.date }}</p> <p>{{ form.date.errors }}<label for="{{ form.date.name }}">{{ form.date.label }}</label> {{ form.date }}</p>
<p>{{ form.mode.errors }}<label for="{{ form.mode.name }}">{{ form.mode.label }}</label> {{ form.mode }}</p> <p>{{ form.mode.errors }}<label for="{{ form.mode.name }}">{{ form.mode.label }}</label> {{ form.mode }}</p>
<p>{{ form.cheque_number.errors }}<label for="{{ form.cheque_number.name }}">{{ form.cheque_number.label }}</label> {{ <p>{{ form.cheque_number.errors }}<label for="{{ form.cheque_number.name }}">{{ form.cheque_number.label }}</label> {{
...@@ -65,6 +66,7 @@ ...@@ -65,6 +66,7 @@
var club_account = $('#id_club_account_wrapper'); var club_account = $('#id_club_account_wrapper');
var company = $('#id_company_wrapper'); var company = $('#id_company_wrapper');
var other = $('#id_target_label'); var other = $('#id_target_label');
var need_link = $('#id_need_link_full');
function update_targets () { function update_targets () {
if (target_type.val() == "USER") { if (target_type.val() == "USER") {
console.log(user); console.log(user);
...@@ -73,8 +75,10 @@ ...@@ -73,8 +75,10 @@
club_account.hide(); club_account.hide();
company.hide(); company.hide();
other.hide(); other.hide();
need_link.hide();
} else if (target_type.val() == "ACCOUNT") { } else if (target_type.val() == "ACCOUNT") {
club_account.show(); club_account.show();
need_link.show();
user.hide(); user.hide();
club.hide(); club.hide();
company.hide(); company.hide();
...@@ -85,24 +89,28 @@ ...@@ -85,24 +89,28 @@
club_account.hide(); club_account.hide();
company.hide(); company.hide();
other.hide(); other.hide();
need_link.hide();
} else if (target_type.val() == "COMPANY") { } else if (target_type.val() == "COMPANY") {
company.show(); company.show();
user.hide(); user.hide();
club_account.hide(); club_account.hide();
club.hide(); club.hide();
other.hide(); other.hide();
need_link.hide();
} else if (target_type.val() == "OTHER") { } else if (target_type.val() == "OTHER") {
other.show(); other.show();
user.hide(); user.hide();
club.hide(); club.hide();
club_account.hide(); club_account.hide();
company.hide(); company.hide();
need_link.hide();
} else { } else {
company.hide(); company.hide();
user.hide(); user.hide();
club_account.hide(); club_account.hide();
club.hide(); club.hide();
other.hide(); other.hide();
need_link.hide();
} }
} }
update_targets(); update_targets();
......
...@@ -304,6 +304,7 @@ class OperationForm(forms.ModelForm): ...@@ -304,6 +304,7 @@ class OperationForm(forms.ModelForm):
club_account = AutoCompleteSelectField('club_accounts', help_text=None, required=False) club_account = AutoCompleteSelectField('club_accounts', help_text=None, required=False)
club = AutoCompleteSelectField('clubs', help_text=None, required=False) club = AutoCompleteSelectField('clubs', help_text=None, required=False)
company = AutoCompleteSelectField('companies', help_text=None, required=False) company = AutoCompleteSelectField('companies', help_text=None, required=False)
need_link = forms.BooleanField(label=_("Link this operation to the target account"), required=False, initial=False)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
club_account = kwargs.pop('club_account', None) club_account = kwargs.pop('club_account', None)
...@@ -341,7 +342,7 @@ class OperationForm(forms.ModelForm): ...@@ -341,7 +342,7 @@ class OperationForm(forms.ModelForm):
def save(self): def save(self):
ret = super(OperationForm, self).save() ret = super(OperationForm, self).save()
if self.instance.target_type == "ACCOUNT" and not self.instance.linked_operation and self.instance.target.has_open_journal(): if self.instance.target_type == "ACCOUNT" and not self.instance.linked_operation and self.instance.target.has_open_journal() and self.cleaned_data['need_link']:
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(
......
...@@ -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: 2017-10-11 12:22+0200\n" "POT-Creation-Date: 2017-10-22 22:27+0200\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"
...@@ -18,7 +18,7 @@ msgstr "" ...@@ -18,7 +18,7 @@ msgstr ""
#: accounting/models.py:61 accounting/models.py:110 accounting/models.py:138 #: accounting/models.py:61 accounting/models.py:110 accounting/models.py:138
#: accounting/models.py:197 club/models.py:47 #: accounting/models.py:197 club/models.py:47
#: core/templates/core/base.jinja:298 counter/models.py:113 #: core/templates/core/base.jinja:301 counter/models.py:113
#: counter/models.py:139 counter/models.py:183 forum/models.py:49 #: counter/models.py:139 counter/models.py:183 forum/models.py:49
#: launderette/models.py:38 launderette/models.py:84 launderette/models.py:110 #: launderette/models.py:38 launderette/models.py:84 launderette/models.py:110
#: stock/models.py:38 stock/models.py:54 stock/models.py:77 stock/models.py:97 #: stock/models.py:38 stock/models.py:54 stock/models.py:77 stock/models.py:97
...@@ -216,7 +216,7 @@ msgstr "Compte" ...@@ -216,7 +216,7 @@ msgstr "Compte"
msgid "Company" msgid "Company"
msgstr "Entreprise" msgstr "Entreprise"
#: accounting/models.py:271 sith/settings.py:372 #: accounting/models.py:271 sith/settings.py:375
#: stock/templates/stock/shopping_list_items.jinja:37 #: stock/templates/stock/shopping_list_items.jinja:37
msgid "Other" msgid "Other"
msgstr "Autre" msgstr "Autre"
...@@ -278,14 +278,14 @@ msgstr "type de mouvement" ...@@ -278,14 +278,14 @@ msgstr "type de mouvement"
#: accounting/models.py:372 #: accounting/models.py:372
#: accounting/templates/accounting/journal_statement_nature.jinja:9 #: accounting/templates/accounting/journal_statement_nature.jinja:9
#: accounting/templates/accounting/journal_statement_person.jinja:12 #: accounting/templates/accounting/journal_statement_person.jinja:12
#: accounting/views.py:481 #: accounting/views.py:482
msgid "Credit" msgid "Credit"
msgstr "Crédit" msgstr "Crédit"
#: accounting/models.py:372 #: accounting/models.py:372
#: accounting/templates/accounting/journal_statement_nature.jinja:28 #: accounting/templates/accounting/journal_statement_nature.jinja:28
#: accounting/templates/accounting/journal_statement_person.jinja:40 #: accounting/templates/accounting/journal_statement_person.jinja:40
#: accounting/views.py:481 #: accounting/views.py:482
msgid "Debit" msgid "Debit"
msgstr "Débit" msgstr "Débit"
...@@ -750,11 +750,11 @@ msgstr "" ...@@ -750,11 +750,11 @@ msgstr ""
"créée dans le compte cible. Si vous ne le voulez pas, sélectionnez <em>Club</" "créée dans le compte cible. Si vous ne le voulez pas, sélectionnez <em>Club</"
"em> à la place de <em>Compte</em>." "em> à la place de <em>Compte</em>."
#: accounting/templates/accounting/operation_edit.jinja:46 #: accounting/templates/accounting/operation_edit.jinja:47
msgid "Linked operation:" msgid "Linked operation:"
msgstr "Opération liée : " msgstr "Opération liée : "
#: accounting/templates/accounting/operation_edit.jinja:54 #: accounting/templates/accounting/operation_edit.jinja:55
#: com/templates/com/news_edit.jinja:57 com/templates/com/weekmail.jinja:74 #: com/templates/com/news_edit.jinja:57 com/templates/com/weekmail.jinja:74
#: core/templates/core/create.jinja:12 core/templates/core/edit.jinja:7 #: 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/edit.jinja.py:15 core/templates/core/edit.jinja:20
...@@ -775,7 +775,7 @@ msgstr "Sauver" ...@@ -775,7 +775,7 @@ msgstr "Sauver"
#: accounting/templates/accounting/refound_account.jinja:4 #: accounting/templates/accounting/refound_account.jinja:4
#: accounting/templates/accounting/refound_account.jinja:9 #: accounting/templates/accounting/refound_account.jinja:9
#: accounting/views.py:757 #: accounting/views.py:758
msgid "Refound account" msgid "Refound account"
msgstr "Remboursement de compte" msgstr "Remboursement de compte"
...@@ -796,7 +796,7 @@ msgstr "Types simplifiés" ...@@ -796,7 +796,7 @@ msgstr "Types simplifiés"
msgid "New simplified type" msgid "New simplified type"
msgstr "Nouveau type simplifié" msgstr "Nouveau type simplifié"
#: accounting/views.py:208 accounting/views.py:215 accounting/views.py:464 #: accounting/views.py:208 accounting/views.py:215 accounting/views.py:465
msgid "Journal" msgid "Journal"
msgstr "Classeur" msgstr "Classeur"
...@@ -812,67 +812,71 @@ msgstr "Bilan par personne" ...@@ -812,67 +812,71 @@ msgstr "Bilan par personne"
msgid "Accounting statement" msgid "Accounting statement"
msgstr "Bilan comptable" msgstr "Bilan comptable"
#: accounting/views.py:326 #: accounting/views.py:307
msgid "Link this operation to the target account"
msgstr "Lier cette opération au compte cible"
#: accounting/views.py:327
msgid "The target must be set." msgid "The target must be set."
msgstr "La cible doit être indiquée." msgstr "La cible doit être indiquée."
#: accounting/views.py:338 #: accounting/views.py:339
msgid "The amount must be set." msgid "The amount must be set."
msgstr "Le montant doit être indiqué." msgstr "Le montant doit être indiqué."
#: accounting/views.py:458 accounting/views.py:464 #: accounting/views.py:459 accounting/views.py:465
msgid "Operation" msgid "Operation"
msgstr "Opération" msgstr "Opération"
#: accounting/views.py:474 #: accounting/views.py:475
msgid "Financial proof: " msgid "Financial proof: "
msgstr "Justificatif de libellé : " msgstr "Justificatif de libellé : "
#: accounting/views.py:475 #: accounting/views.py:476
#, python-format #, python-format
msgid "Club: %(club_name)s" msgid "Club: %(club_name)s"
msgstr "Club : %(club_name)s" msgstr "Club : %(club_name)s"
#: accounting/views.py:476 #: accounting/views.py:477
#, python-format #, python-format
msgid "Label: %(op_label)s" msgid "Label: %(op_label)s"
msgstr "Libellé : %(op_label)s" msgstr "Libellé : %(op_label)s"
#: accounting/views.py:477 #: accounting/views.py:478
#, python-format #, python-format
msgid "Date: %(date)s" msgid "Date: %(date)s"
msgstr "Date : %(date)s" msgstr "Date : %(date)s"
#: accounting/views.py:483 #: accounting/views.py:484
#, python-format #, python-format
msgid "Amount: %(amount).2f €" msgid "Amount: %(amount).2f €"
msgstr "Montant : %(amount).2f €" msgstr "Montant : %(amount).2f €"
#: accounting/views.py:495 #: accounting/views.py:496
msgid "Debtor" msgid "Debtor"
msgstr "Débiteur" msgstr "Débiteur"
#: accounting/views.py:495 #: accounting/views.py:496
msgid "Creditor" msgid "Creditor"
msgstr "Créditeur" msgstr "Créditeur"
#: accounting/views.py:497 #: accounting/views.py:498
msgid "Comment:" msgid "Comment:"
msgstr "Commentaire :" msgstr "Commentaire :"
#: accounting/views.py:516 #: accounting/views.py:517
msgid "Signature:" msgid "Signature:"
msgstr "Signature :" msgstr "Signature :"
#: accounting/views.py:573 #: accounting/views.py:574
msgid "General statement" msgid "General statement"
msgstr "Bilan général" msgstr "Bilan général"
#: accounting/views.py:576 #: accounting/views.py:577
msgid "No label operations" msgid "No label operations"
msgstr "Opérations sans étiquette" msgstr "Opérations sans étiquette"
#: accounting/views.py:718 #: accounting/views.py:719
msgid "Refound this account" msgid "Refound this account"
msgstr "Rembourser ce compte" msgstr "Rembourser ce compte"
...@@ -1232,7 +1236,7 @@ msgstr "Anciens membres" ...@@ -1232,7 +1236,7 @@ msgstr "Anciens membres"
msgid "History" msgid "History"
msgstr "Historique" msgstr "Historique"
#: club/views.py:121 core/templates/core/base.jinja:116 core/views/user.py:180 #: club/views.py:121 core/templates/core/base.jinja:119 core/views/user.py:180
#: sas/templates/sas/picture.jinja:95 trombi/views.py:55 #: sas/templates/sas/picture.jinja:95 trombi/views.py:55
msgid "Tools" msgid "Tools"
msgstr "Outils" msgstr "Outils"
...@@ -1453,7 +1457,7 @@ msgstr "Type" ...@@ -1453,7 +1457,7 @@ msgstr "Type"
#: com/templates/com/news_admin_list.jinja:249 #: com/templates/com/news_admin_list.jinja:249
#: com/templates/com/news_admin_list.jinja:286 #: com/templates/com/news_admin_list.jinja:286
#: com/templates/com/weekmail.jinja:19 com/templates/com/weekmail.jinja:48 #: com/templates/com/weekmail.jinja:19 com/templates/com/weekmail.jinja:48
#: core/templates/core/base.jinja:308 forum/templates/forum/forum.jinja:29 #: core/templates/core/base.jinja:311 forum/templates/forum/forum.jinja:29
#: forum/templates/forum/forum.jinja:48 forum/templates/forum/main.jinja:25 #: forum/templates/forum/forum.jinja:48 forum/templates/forum/main.jinja:25
#: forum/views.py:159 #: forum/views.py:159
msgid "Title" msgid "Title"
...@@ -1891,7 +1895,7 @@ msgstr "-" ...@@ -1891,7 +1895,7 @@ msgstr "-"
msgid "XS" msgid "XS"
msgstr "XS" msgstr "XS"
#: core/models.py:172 core/templates/core/base.jinja:321 #: core/models.py:172 core/templates/core/base.jinja:324
msgid "S" msgid "S"
msgstr "S" msgstr "S"
...@@ -2176,67 +2180,67 @@ msgstr "404. Non trouvé" ...@@ -2176,67 +2180,67 @@ msgstr "404. Non trouvé"
msgid "Welcome!" msgid "Welcome!"
msgstr "Bienvenue!" msgstr "Bienvenue!"
#: core/templates/core/base.jinja:47 #: core/templates/core/base.jinja:50
msgid "Username" msgid "Username"
msgstr "Nom d'utilisateur" msgstr "Nom d'utilisateur"
#: core/templates/core/base.jinja:49 #: core/templates/core/base.jinja:52
msgid "Password" msgid "Password"
msgstr "Mot de passe" msgstr "Mot de passe"
#: core/templates/core/base.jinja:51 core/templates/core/login.jinja:4 #: core/templates/core/base.jinja:54 core/templates/core/login.jinja:4
#: core/templates/core/password_reset_complete.jinja:5 #: core/templates/core/password_reset_complete.jinja:5
msgid "Login" msgid "Login"
msgstr "Connexion" msgstr "Connexion"
#: core/templates/core/base.jinja:53 core/templates/core/register.jinja:18 #: core/templates/core/base.jinja:56 core/templates/core/register.jinja:18
msgid "Register" msgid "Register"
msgstr "S'enregister" msgstr "S'enregister"
#: core/templates/core/base.jinja:78 core/templates/core/base.jinja.py:79 #: core/templates/core/base.jinja:81 core/templates/core/base.jinja.py:82
#: matmat/templates/matmat/search_form.jinja:50 #: matmat/templates/matmat/search_form.jinja:50
#: matmat/templates/matmat/search_form.jinja:60 #: matmat/templates/matmat/search_form.jinja:60
#: matmat/templates/matmat/search_form.jinja:71 #: matmat/templates/matmat/search_form.jinja:71
msgid "Search" msgid "Search"
msgstr "Recherche" msgstr "Recherche"
#: core/templates/core/base.jinja:105 #: core/templates/core/base.jinja:108
msgid "View more" msgid "View more"
msgstr "Voir plus" msgstr "Voir plus"
#: core/templates/core/base.jinja:109 #: core/templates/core/base.jinja:112
#: forum/templates/forum/last_unread.jinja:16 #: forum/templates/forum/last_unread.jinja:16
msgid "Mark all as read" msgid "Mark all as read"
msgstr "Marquer tout commme lu" msgstr "Marquer tout commme lu"
#: core/templates/core/base.jinja:119 #: core/templates/core/base.jinja:122
msgid "Logout" msgid "Logout"
msgstr "Déconnexion" msgstr "Déconnexion"
#: core/templates/core/base.jinja:152 #: core/templates/core/base.jinja:155
msgid "Main" msgid "Main"
msgstr "Accueil" msgstr "Accueil"
#: core/templates/core/base.jinja:153 core/templates/core/search.jinja:18 #: core/templates/core/base.jinja:156 core/templates/core/search.jinja:18
#: core/views/user.py:197 counter/templates/counter/stats.jinja:17 #: core/views/user.py:197 counter/templates/counter/stats.jinja:17
msgid "Clubs" msgid "Clubs"
msgstr "Clubs" msgstr "Clubs"
#: core/templates/core/base.jinja:154 #: core/templates/core/base.jinja:157
msgid "Matmatronch" msgid "Matmatronch"
msgstr "Matmatronch" msgstr "Matmatronch"
#: core/templates/core/base.jinja:155 #: core/templates/core/base.jinja:158
msgid "Wiki" msgid "Wiki"
msgstr "Wiki" msgstr "Wiki"
#: core/templates/core/base.jinja:156 sas/templates/sas/album.jinja:4 #: core/templates/core/base.jinja:159 sas/templates/sas/album.jinja:4
#: sas/templates/sas/main.jinja:4 sas/templates/sas/main.jinja.py:32 #: sas/templates/sas/main.jinja:4 sas/templates/sas/main.jinja.py:32
#: sas/templates/sas/picture.jinja:34 #: sas/templates/sas/picture.jinja:34
msgid "SAS" msgid "SAS"
msgstr "SAS" msgstr "SAS"
#: core/templates/core/base.jinja:157 forum/templates/forum/forum.jinja:10 #: core/templates/core/base.jinja:160 forum/templates/forum/forum.jinja:10
#: forum/templates/forum/last_unread.jinja:13 #: forum/templates/forum/last_unread.jinja:13
#: forum/templates/forum/main.jinja:6 forum/templates/forum/main.jinja.py:11 #: forum/templates/forum/main.jinja:6 forum/templates/forum/main.jinja.py:11
#: forum/templates/forum/main.jinja:14 forum/templates/forum/reply.jinja:15 #: forum/templates/forum/main.jinja:14 forum/templates/forum/reply.jinja:15
...@@ -2244,84 +2248,84 @@ msgstr "SAS" ...@@ -2244,84 +2248,84 @@ msgstr "SAS"
msgid "Forum" msgid "Forum"
msgstr "Forum" msgstr "Forum"
#: core/templates/core/base.jinja:158 #: core/templates/core/base.jinja:161
msgid "Services" msgid "Services"
msgstr "Services" msgstr "Services"
#: core/templates/core/base.jinja:159 core/templates/core/file.jinja:20 #: core/templates/core/base.jinja:162 core/templates/core/file.jinja:20
#: core/views/files.py:75 #: core/views/files.py:75
msgid "Files" msgid "Files"
msgstr "Fichiers" msgstr "Fichiers"
#: core/templates/core/base.jinja:160 #: core/templates/core/base.jinja:163
msgid "Sponsors" msgid "Sponsors"
msgstr "Partenaires" msgstr "Partenaires"
#: core/templates/core/base.jinja:161 #: core/templates/core/base.jinja:164
msgid "Help" msgid "Help"
msgstr "Aide" msgstr "Aide"
#: core/templates/core/base.jinja:201 #: core/templates/core/base.jinja:204
msgid "Contacts" msgid "Contacts"
msgstr "Contacts" msgstr "Contacts"
#: core/templates/core/base.jinja:202 #: core/templates/core/base.jinja:205
msgid "Legal notices" msgid "Legal notices"
msgstr "Mentions légales" msgstr "Mentions légales"
#: core/templates/core/base.jinja:203 #: core/templates/core/base.jinja:206
msgid "Intellectual property" msgid "Intellectual property"
msgstr "Propriété intellectuelle" msgstr "Propriété intellectuelle"
#: core/templates/core/base.jinja:204 #: core/templates/core/base.jinja:207
msgid "Help & Documentation" msgid "Help & Documentation"
msgstr "Aide & Documentation" msgstr "Aide & Documentation"
#: core/templates/core/base.jinja:205 #: core/templates/core/base.jinja:208
msgid "R&D" msgid "R&D"
msgstr "R&D" msgstr "R&D"
#: core/templates/core/base.jinja:206 #: core/templates/core/base.jinja:209
msgid "Former website" msgid "Former website"
msgstr "Ancien site" msgstr "Ancien site"
#: core/templates/core/base.jinja:208 #: core/templates/core/base.jinja:211
msgid "Site made by good people" msgid "Site made by good people"
msgstr "Site réalisé par des gens bons" msgstr "Site réalisé par des gens bons"
#: core/templates/core/base.jinja:305 #: core/templates/core/base.jinja:308
msgid "https://path/to/image.gif" msgid "https://path/to/image.gif"
msgstr "https://chemin/vers/image.gif" msgstr "https://chemin/vers/image.gif"
#: core/templates/core/base.jinja:307 #: core/templates/core/base.jinja:310
msgid "alternative text" msgid "alternative text"
msgstr "texte alternatif" msgstr "texte alternatif"
#: core/templates/core/base.jinja:317 #: core/templates/core/base.jinja:320
msgid "Image" msgid "Image"
msgstr "Image" msgstr "Image"