1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Store note balances in a big integer

This commit is contained in:
Yohann D'ANELLO 2020-08-13 18:04:28 +02:00
parent 2d69e36adf
commit d98e46ffc2
4 changed files with 69 additions and 49 deletions

View File

@ -25,7 +25,7 @@ class Note(PolymorphicModel):
A Note can be searched find throught an :model:`note.Alias` A Note can be searched find throught an :model:`note.Alias`
""" """
balance = models.IntegerField( balance = models.BigIntegerField(
verbose_name=_('account balance'), verbose_name=_('account balance'),
help_text=_('in centimes, money credited for this instance'), help_text=_('in centimes, money credited for this instance'),
default=0, default=0,

View File

@ -196,9 +196,10 @@ class Transaction(PolymorphicModel):
# previously invalid # previously invalid
self.invalidity_reason = None self.invalidity_reason = None
if source_balance > 2147483647 or source_balance < -2147483648\ if source_balance > 9223372036854775807 or source_balance < -9223372036854775808\
or dest_balance > 2147483647 or dest_balance < -2147483648: or dest_balance > 9223372036854775807 or dest_balance < -9223372036854775808:
raise ValidationError(_("The note balances must be between - 21 474 836.47 € and 21 474 836.47 €.")) raise ValidationError(_("The note balances must be between - 92 233 720 368 547 758.08 € "
"and 92 233 720 368 547 758.07 €."))
return source_balance - previous_source_balance, dest_balance - previous_dest_balance return source_balance - previous_source_balance, dest_balance - previous_dest_balance

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-13 15:15+0200\n" "POT-Creation-Date: 2020-08-13 18:02+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -47,7 +47,7 @@ msgstr ""
#: apps/member/models.py:175 apps/member/templates/member/club_info.html:13 #: apps/member/models.py:175 apps/member/templates/member/club_info.html:13
#: apps/member/templates/member/profile_info.html:14 #: apps/member/templates/member/profile_info.html:14
#: apps/note/models/notes.py:212 apps/note/models/transactions.py:25 #: apps/note/models/notes.py:212 apps/note/models/transactions.py:25
#: apps/note/models/transactions.py:45 apps/note/models/transactions.py:286 #: apps/note/models/transactions.py:45 apps/note/models/transactions.py:296
#: apps/permission/models.py:329 #: apps/permission/models.py:329
#: apps/registration/templates/registration/future_profile_detail.html:16 #: apps/registration/templates/registration/future_profile_detail.html:16
#: apps/wei/models.py:66 apps/wei/models.py:118 #: apps/wei/models.py:66 apps/wei/models.py:118
@ -238,7 +238,7 @@ msgid "Guests list"
msgstr "" msgstr ""
#: apps/activity/templates/activity/activity_entry.html:13 #: apps/activity/templates/activity/activity_entry.html:13
#: apps/note/models/transactions.py:248 #: apps/note/models/transactions.py:258
#: apps/note/templates/note/transaction_form.html:15 #: apps/note/templates/note/transaction_form.html:15
#: apps/note/templates/note/transaction_form.html:145 #: apps/note/templates/note/transaction_form.html:145
#: note_kfet/templates/base.html:113 #: note_kfet/templates/base.html:113
@ -246,7 +246,7 @@ msgid "Transfer"
msgstr "" msgstr ""
#: apps/activity/templates/activity/activity_entry.html:17 #: apps/activity/templates/activity/activity_entry.html:17
#: apps/note/models/transactions.py:302 #: apps/note/models/transactions.py:312
#: apps/note/templates/note/transaction_form.html:20 #: apps/note/templates/note/transaction_form.html:20
msgid "Credit" msgid "Credit"
msgstr "" msgstr ""
@ -1162,61 +1162,69 @@ msgstr ""
msgid "transactions" msgid "transactions"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:192 #: apps/note/models/transactions.py:181
#, python-brace-format
msgid "" msgid ""
"The note balances must be between - 21 474 836.47 € and 21 474 836.47 €." "You can't update the {field} on a Transaction. Please invalidate it and "
"create one other."
msgstr "" msgstr ""
#: apps/note/models/transactions.py:207 #: apps/note/models/transactions.py:201
msgid ""
"The note balances must be between - 92 233 720 368 547 758.08 € and 92 233 "
"720 368 547 758.07 €."
msgstr ""
#: apps/note/models/transactions.py:217
msgid "" msgid ""
"The transaction can't be saved since the source note or the destination note " "The transaction can't be saved since the source note or the destination note "
"is not active." "is not active."
msgstr "" msgstr ""
#: apps/note/models/transactions.py:272 #: apps/note/models/transactions.py:282
msgid "Template" msgid "Template"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:275 #: apps/note/models/transactions.py:285
msgid "recurrent transaction" msgid "recurrent transaction"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:276 #: apps/note/models/transactions.py:286
msgid "recurrent transactions" msgid "recurrent transactions"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:291 #: apps/note/models/transactions.py:301
msgid "first_name" msgid "first_name"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:296 #: apps/note/models/transactions.py:306
msgid "bank" msgid "bank"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:302 #: apps/note/models/transactions.py:312
#: apps/note/templates/note/transaction_form.html:25 #: apps/note/templates/note/transaction_form.html:25
msgid "Debit" msgid "Debit"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:313 #: apps/note/models/transactions.py:323
msgid "" msgid ""
"A special transaction is only possible between a Note associated to a " "A special transaction is only possible between a Note associated to a "
"payment method and a User or a Club" "payment method and a User or a Club"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:317 #: apps/note/models/transactions.py:327
msgid "Special transaction" msgid "Special transaction"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:318 #: apps/note/models/transactions.py:328
msgid "Special transactions" msgid "Special transactions"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:334 apps/note/models/transactions.py:339 #: apps/note/models/transactions.py:344 apps/note/models/transactions.py:349
msgid "membership transaction" msgid "membership transaction"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:335 apps/treasury/models.py:272 #: apps/note/models/transactions.py:345 apps/treasury/models.py:272
msgid "membership transactions" msgid "membership transactions"
msgstr "" msgstr ""
@ -2600,15 +2608,15 @@ msgstr ""
msgid "This user didn't give her/his caution check." msgid "This user didn't give her/his caution check."
msgstr "" msgstr ""
#: note_kfet/settings/base.py:154 #: note_kfet/settings/base.py:155
msgid "German" msgid "German"
msgstr "" msgstr ""
#: note_kfet/settings/base.py:155 #: note_kfet/settings/base.py:156
msgid "English" msgid "English"
msgstr "" msgstr ""
#: note_kfet/settings/base.py:156 #: note_kfet/settings/base.py:157
msgid "French" msgid "French"
msgstr "" msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-13 15:15+0200\n" "POT-Creation-Date: 2020-08-13 18:02+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -48,7 +48,7 @@ msgstr "Vous ne pouvez pas inviter plus de 3 personnes à cette activité."
#: apps/member/models.py:175 apps/member/templates/member/club_info.html:13 #: apps/member/models.py:175 apps/member/templates/member/club_info.html:13
#: apps/member/templates/member/profile_info.html:14 #: apps/member/templates/member/profile_info.html:14
#: apps/note/models/notes.py:212 apps/note/models/transactions.py:25 #: apps/note/models/notes.py:212 apps/note/models/transactions.py:25
#: apps/note/models/transactions.py:45 apps/note/models/transactions.py:286 #: apps/note/models/transactions.py:45 apps/note/models/transactions.py:296
#: apps/permission/models.py:329 #: apps/permission/models.py:329
#: apps/registration/templates/registration/future_profile_detail.html:16 #: apps/registration/templates/registration/future_profile_detail.html:16
#: apps/wei/models.py:66 apps/wei/models.py:118 #: apps/wei/models.py:66 apps/wei/models.py:118
@ -239,7 +239,7 @@ msgid "Guests list"
msgstr "Liste des invités" msgstr "Liste des invités"
#: apps/activity/templates/activity/activity_entry.html:13 #: apps/activity/templates/activity/activity_entry.html:13
#: apps/note/models/transactions.py:248 #: apps/note/models/transactions.py:258
#: apps/note/templates/note/transaction_form.html:15 #: apps/note/templates/note/transaction_form.html:15
#: apps/note/templates/note/transaction_form.html:145 #: apps/note/templates/note/transaction_form.html:145
#: note_kfet/templates/base.html:113 #: note_kfet/templates/base.html:113
@ -247,7 +247,7 @@ msgid "Transfer"
msgstr "Virement" msgstr "Virement"
#: apps/activity/templates/activity/activity_entry.html:17 #: apps/activity/templates/activity/activity_entry.html:17
#: apps/note/models/transactions.py:302 #: apps/note/models/transactions.py:312
#: apps/note/templates/note/transaction_form.html:20 #: apps/note/templates/note/transaction_form.html:20
msgid "Credit" msgid "Credit"
msgstr "Crédit" msgstr "Crédit"
@ -350,7 +350,9 @@ msgstr "Invitation pour l'activité « {} »"
#: apps/activity/views.py:148 #: apps/activity/views.py:148
msgid "You are not allowed to display the entry interface for this activity." msgid "You are not allowed to display the entry interface for this activity."
msgstr "Vous n'êtes pas autorisé à afficher l'interface des entrées pour cette activité." msgstr ""
"Vous n'êtes pas autorisé à afficher l'interface des entrées pour cette "
"activité."
#: apps/activity/views.py:151 #: apps/activity/views.py:151
msgid "This activity does not support activity entries." msgid "This activity does not support activity entries."
@ -1174,14 +1176,23 @@ msgstr "Transaction"
msgid "transactions" msgid "transactions"
msgstr "Transactions" msgstr "Transactions"
#: apps/note/models/transactions.py:192 #: apps/note/models/transactions.py:181
#, python-brace-format
msgid "" msgid ""
"The note balances must be between - 21 474 836.47 € and 21 474 836.47 €." "You can't update the {field} on a Transaction. Please invalidate it and "
"create one other."
msgstr "" msgstr ""
"Les montants des notes doivent se trouver entre - 21 474 836.47 € et 21 474 "
"836.47 €. Ne cherchez pas à capitaliser l'argent du BDE."
#: apps/note/models/transactions.py:207 #: apps/note/models/transactions.py:201
msgid ""
"The note balances must be between - 92 233 720 368 547 758.08 € and 92 233 "
"720 368 547 758.07 €."
msgstr ""
"Les montants des notes doivent se trouver entre - 92 233 720 368 547 758.08 "
"€ et 92 233 720 368 547 758.07 €. Ne cherchez pas à capitaliser l'argent du "
"BDE."
#: apps/note/models/transactions.py:217
msgid "" msgid ""
"The transaction can't be saved since the source note or the destination note " "The transaction can't be saved since the source note or the destination note "
"is not active." "is not active."
@ -1189,32 +1200,32 @@ msgstr ""
"La transaction ne peut pas être sauvegardée puisque la note source ou la " "La transaction ne peut pas être sauvegardée puisque la note source ou la "
"note de destination n'est pas active." "note de destination n'est pas active."
#: apps/note/models/transactions.py:272 #: apps/note/models/transactions.py:282
msgid "Template" msgid "Template"
msgstr "Bouton" msgstr "Bouton"
#: apps/note/models/transactions.py:275 #: apps/note/models/transactions.py:285
msgid "recurrent transaction" msgid "recurrent transaction"
msgstr "Transaction issue de bouton" msgstr "Transaction issue de bouton"
#: apps/note/models/transactions.py:276 #: apps/note/models/transactions.py:286
msgid "recurrent transactions" msgid "recurrent transactions"
msgstr "Transactions issues de boutons" msgstr "Transactions issues de boutons"
#: apps/note/models/transactions.py:291 #: apps/note/models/transactions.py:301
msgid "first_name" msgid "first_name"
msgstr "prénom" msgstr "prénom"
#: apps/note/models/transactions.py:296 #: apps/note/models/transactions.py:306
msgid "bank" msgid "bank"
msgstr "banque" msgstr "banque"
#: apps/note/models/transactions.py:302 #: apps/note/models/transactions.py:312
#: apps/note/templates/note/transaction_form.html:25 #: apps/note/templates/note/transaction_form.html:25
msgid "Debit" msgid "Debit"
msgstr "Débit" msgstr "Débit"
#: apps/note/models/transactions.py:313 #: apps/note/models/transactions.py:323
msgid "" msgid ""
"A special transaction is only possible between a Note associated to a " "A special transaction is only possible between a Note associated to a "
"payment method and a User or a Club" "payment method and a User or a Club"
@ -1222,19 +1233,19 @@ msgstr ""
"Une transaction spéciale n'est possible que entre une note associée à un " "Une transaction spéciale n'est possible que entre une note associée à un "
"mode de paiement et un utilisateur ou un club." "mode de paiement et un utilisateur ou un club."
#: apps/note/models/transactions.py:317 #: apps/note/models/transactions.py:327
msgid "Special transaction" msgid "Special transaction"
msgstr "Transaction de crédit/retrait" msgstr "Transaction de crédit/retrait"
#: apps/note/models/transactions.py:318 #: apps/note/models/transactions.py:328
msgid "Special transactions" msgid "Special transactions"
msgstr "Transactions de crédit/retrait" msgstr "Transactions de crédit/retrait"
#: apps/note/models/transactions.py:334 apps/note/models/transactions.py:339 #: apps/note/models/transactions.py:344 apps/note/models/transactions.py:349
msgid "membership transaction" msgid "membership transaction"
msgstr "Transaction d'adhésion" msgstr "Transaction d'adhésion"
#: apps/note/models/transactions.py:335 apps/treasury/models.py:272 #: apps/note/models/transactions.py:345 apps/treasury/models.py:272
msgid "membership transactions" msgid "membership transactions"
msgstr "Transactions d'adhésion" msgstr "Transactions d'adhésion"
@ -2697,15 +2708,15 @@ msgstr "Valider l'inscription WEI"
msgid "This user didn't give her/his caution check." msgid "This user didn't give her/his caution check."
msgstr "Cet utilisateur n'a pas donné son chèque de caution." msgstr "Cet utilisateur n'a pas donné son chèque de caution."
#: note_kfet/settings/base.py:154 #: note_kfet/settings/base.py:155
msgid "German" msgid "German"
msgstr "Allemand" msgstr "Allemand"
#: note_kfet/settings/base.py:155 #: note_kfet/settings/base.py:156
msgid "English" msgid "English"
msgstr "Anglais" msgstr "Anglais"
#: note_kfet/settings/base.py:156 #: note_kfet/settings/base.py:157
msgid "French" msgid "French"
msgstr "Français" msgstr "Français"