Store used aliases in transactions

This commit is contained in:
Yohann D'ANELLO 2020-03-26 14:45:48 +01:00
parent 5cf75ebf9e
commit 41aa6964d2
6 changed files with 136 additions and 75 deletions

View File

@ -2,6 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from django.db import models from django.db import models
from django.db.models import F
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@ -93,12 +94,26 @@ class Transaction(PolymorphicModel):
related_name='+', related_name='+',
verbose_name=_('source'), verbose_name=_('source'),
) )
source_alias = models.CharField(
max_length=255,
default="", # Will be remplaced by the name of the note on save
verbose_name=_('used alias'),
)
destination = models.ForeignKey( destination = models.ForeignKey(
Note, Note,
on_delete=models.PROTECT, on_delete=models.PROTECT,
related_name='+', related_name='+',
verbose_name=_('destination'), verbose_name=_('destination'),
) )
destination_alias = models.CharField(
max_length=255,
default="", # Will be remplaced by the name of the note on save
verbose_name=_('used alias'),
)
created_at = models.DateTimeField( created_at = models.DateTimeField(
verbose_name=_('created at'), verbose_name=_('created at'),
default=timezone.now, default=timezone.now,
@ -142,6 +157,13 @@ class Transaction(PolymorphicModel):
When saving, also transfer money between two notes When saving, also transfer money between two notes
""" """
# If the aliases are not entered, we assume that the used alias is the name of the note
if not self.source_alias:
self.source_alias = str(self.source)
if not self.destination_alias:
self.destination_alias = str(self.destination)
if self.source.pk == self.destination.pk: if self.source.pk == self.destination.pk:
# When source == destination, no money is transfered # When source == destination, no money is transfered
super().save(*args, **kwargs) super().save(*args, **kwargs)

View File

@ -21,11 +21,29 @@ class HistoryTable(tables.Table):
'table table-condensed table-striped table-hover' 'table table-condensed table-striped table-hover'
} }
model = Transaction model = Transaction
exclude = ("id", "polymorphic_ctype", "invalidity_reason") exclude = ("id", "polymorphic_ctype", "invalidity_reason", "source_alias", "destination_alias",)
template_name = 'django_tables2/bootstrap4.html' template_name = 'django_tables2/bootstrap4.html'
sequence = ('...', 'type', 'total', 'valid',) sequence = ('...', 'type', 'total', 'valid',)
orderable = False orderable = False
source = tables.Column(
attrs={
"td": {
"data-toggle": "tooltip",
"title": lambda record: _("used alias").capitalize() + " : " + record.source_alias,
}
}
)
destination = tables.Column(
attrs={
"td": {
"data-toggle": "tooltip",
"title": lambda record: _("used alias").capitalize() + " : " + record.destination_alias,
}
}
)
type = tables.Column() type = tables.Column()
total = tables.Column() # will use Transaction.total() !! total = tables.Column() # will use Transaction.total() !!

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-03-25 14:46+0100\n" "POT-Creation-Date: 2020-03-26 14:40+0100\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"
@ -24,8 +24,8 @@ msgstr ""
#: apps/activity/models.py:19 apps/activity/models.py:44 #: apps/activity/models.py:19 apps/activity/models.py:44
#: apps/member/models.py:63 apps/member/models.py:114 #: apps/member/models.py:63 apps/member/models.py:114
#: apps/note/models/notes.py:188 apps/note/models/transactions.py:24 #: apps/note/models/notes.py:188 apps/note/models/transactions.py:25
#: apps/note/models/transactions.py:44 apps/note/models/transactions.py:210 #: apps/note/models/transactions.py:45 apps/note/models/transactions.py:232
#: templates/member/profile_detail.html:15 #: templates/member/profile_detail.html:15
msgid "name" msgid "name"
msgstr "" msgstr ""
@ -46,13 +46,13 @@ msgstr ""
msgid "activity types" msgid "activity types"
msgstr "" msgstr ""
#: apps/activity/models.py:48 apps/note/models/transactions.py:69 #: apps/activity/models.py:48 apps/note/models/transactions.py:70
#: apps/permission/models.py:91 #: apps/permission/models.py:91
msgid "description" msgid "description"
msgstr "" msgstr ""
#: apps/activity/models.py:54 apps/note/models/notes.py:164 #: apps/activity/models.py:54 apps/note/models/notes.py:164
#: apps/note/models/transactions.py:62 #: apps/note/models/transactions.py:63
msgid "type" msgid "type"
msgstr "" msgstr ""
@ -120,11 +120,11 @@ msgstr ""
msgid "create" msgid "create"
msgstr "" msgstr ""
#: apps/logs/models.py:61 apps/note/tables.py:126 #: apps/logs/models.py:61 apps/note/tables.py:147
msgid "edit" msgid "edit"
msgstr "" msgstr ""
#: apps/logs/models.py:62 apps/note/tables.py:130 #: apps/logs/models.py:62 apps/note/tables.py:151
msgid "delete" msgid "delete"
msgstr "" msgstr ""
@ -255,12 +255,12 @@ msgstr ""
msgid "Alias successfully deleted" msgid "Alias successfully deleted"
msgstr "" msgstr ""
#: apps/note/admin.py:120 apps/note/models/transactions.py:94 #: apps/note/admin.py:120 apps/note/models/transactions.py:95
msgid "source" msgid "source"
msgstr "" msgstr ""
#: apps/note/admin.py:128 apps/note/admin.py:156 #: apps/note/admin.py:128 apps/note/admin.py:156
#: apps/note/models/transactions.py:53 apps/note/models/transactions.py:100 #: apps/note/models/transactions.py:54 apps/note/models/transactions.py:108
msgid "destination" msgid "destination"
msgstr "" msgstr ""
@ -310,7 +310,7 @@ msgstr ""
msgid "display image" msgid "display image"
msgstr "" msgstr ""
#: apps/note/models/notes.py:53 apps/note/models/transactions.py:103 #: apps/note/models/notes.py:53 apps/note/models/transactions.py:118
msgid "created at" msgid "created at"
msgstr "" msgstr ""
@ -384,101 +384,106 @@ msgstr ""
msgid "You can't delete your main alias." msgid "You can't delete your main alias."
msgstr "" msgstr ""
#: apps/note/models/transactions.py:30 #: apps/note/models/transactions.py:31
msgid "transaction category" msgid "transaction category"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:31 #: apps/note/models/transactions.py:32
msgid "transaction categories" msgid "transaction categories"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:47 #: apps/note/models/transactions.py:48
msgid "A template with this name already exist" msgid "A template with this name already exist"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:56 apps/note/models/transactions.py:111 #: apps/note/models/transactions.py:57 apps/note/models/transactions.py:126
msgid "amount" msgid "amount"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:57 #: apps/note/models/transactions.py:58
msgid "in centimes" msgid "in centimes"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:75 #: apps/note/models/transactions.py:76
msgid "transaction template" msgid "transaction template"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:76 #: apps/note/models/transactions.py:77
msgid "transaction templates" msgid "transaction templates"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:107 #: apps/note/models/transactions.py:101 apps/note/models/transactions.py:114
#: apps/note/tables.py:33 apps/note/tables.py:42
msgid "used alias"
msgstr ""
#: apps/note/models/transactions.py:122
msgid "quantity" msgid "quantity"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:115 #: apps/note/models/transactions.py:130
msgid "reason" msgid "reason"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:120 #: apps/note/models/transactions.py:135
msgid "valid" msgid "valid"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:125 apps/note/tables.py:74 #: apps/note/models/transactions.py:140 apps/note/tables.py:95
msgid "invalidity reason" msgid "invalidity reason"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:132 #: apps/note/models/transactions.py:147
msgid "transaction" msgid "transaction"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:133 #: apps/note/models/transactions.py:148
msgid "transactions" msgid "transactions"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:180 templates/base.html:83 #: apps/note/models/transactions.py:202 templates/base.html:83
#: templates/note/transaction_form.html:19 #: templates/note/transaction_form.html:19
#: templates/note/transaction_form.html:145 #: templates/note/transaction_form.html:145
msgid "Transfer" msgid "Transfer"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:200 #: apps/note/models/transactions.py:222
msgid "Template" msgid "Template"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:215 #: apps/note/models/transactions.py:237
msgid "first_name" msgid "first_name"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:220 #: apps/note/models/transactions.py:242
msgid "bank" msgid "bank"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:226 templates/note/transaction_form.html:24 #: apps/note/models/transactions.py:248 templates/note/transaction_form.html:24
msgid "Credit" msgid "Credit"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:226 templates/note/transaction_form.html:28 #: apps/note/models/transactions.py:248 templates/note/transaction_form.html:28
msgid "Debit" msgid "Debit"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:242 apps/note/models/transactions.py:247 #: apps/note/models/transactions.py:264 apps/note/models/transactions.py:269
msgid "membership transaction" msgid "membership transaction"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:243 #: apps/note/models/transactions.py:265
msgid "membership transactions" msgid "membership transactions"
msgstr "" msgstr ""
#: apps/note/tables.py:39 #: apps/note/tables.py:57
msgid "Click to invalidate" msgid "Click to invalidate"
msgstr "" msgstr ""
#: apps/note/tables.py:39 #: apps/note/tables.py:57
msgid "Click to validate" msgid "Click to validate"
msgstr "" msgstr ""
#: apps/note/tables.py:72 #: apps/note/tables.py:93
msgid "No reason specified" msgid "No reason specified"
msgstr "" msgstr ""

View File

@ -3,7 +3,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-03-25 14:46+0100\n" "POT-Creation-Date: 2020-03-26 14:40+0100\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"
@ -19,8 +19,8 @@ msgstr "activité"
#: apps/activity/models.py:19 apps/activity/models.py:44 #: apps/activity/models.py:19 apps/activity/models.py:44
#: apps/member/models.py:63 apps/member/models.py:114 #: apps/member/models.py:63 apps/member/models.py:114
#: apps/note/models/notes.py:188 apps/note/models/transactions.py:24 #: apps/note/models/notes.py:188 apps/note/models/transactions.py:25
#: apps/note/models/transactions.py:44 apps/note/models/transactions.py:210 #: apps/note/models/transactions.py:45 apps/note/models/transactions.py:232
#: templates/member/profile_detail.html:15 #: templates/member/profile_detail.html:15
msgid "name" msgid "name"
msgstr "nom" msgstr "nom"
@ -41,13 +41,13 @@ msgstr "type d'activité"
msgid "activity types" msgid "activity types"
msgstr "types d'activité" msgstr "types d'activité"
#: apps/activity/models.py:48 apps/note/models/transactions.py:69 #: apps/activity/models.py:48 apps/note/models/transactions.py:70
#: apps/permission/models.py:91 #: apps/permission/models.py:91
msgid "description" msgid "description"
msgstr "description" msgstr "description"
#: apps/activity/models.py:54 apps/note/models/notes.py:164 #: apps/activity/models.py:54 apps/note/models/notes.py:164
#: apps/note/models/transactions.py:62 #: apps/note/models/transactions.py:63
msgid "type" msgid "type"
msgstr "type" msgstr "type"
@ -115,11 +115,11 @@ msgstr "Nouvelles données"
msgid "create" msgid "create"
msgstr "Créer" msgstr "Créer"
#: apps/logs/models.py:61 apps/note/tables.py:126 #: apps/logs/models.py:61 apps/note/tables.py:147
msgid "edit" msgid "edit"
msgstr "Modifier" msgstr "Modifier"
#: apps/logs/models.py:62 apps/note/tables.py:130 #: apps/logs/models.py:62 apps/note/tables.py:151
msgid "delete" msgid "delete"
msgstr "Supprimer" msgstr "Supprimer"
@ -254,12 +254,12 @@ msgstr "Compte n°%(id)s : %(username)s"
msgid "Alias successfully deleted" msgid "Alias successfully deleted"
msgstr "L'alias a bien été supprimé" msgstr "L'alias a bien été supprimé"
#: apps/note/admin.py:120 apps/note/models/transactions.py:94 #: apps/note/admin.py:120 apps/note/models/transactions.py:95
msgid "source" msgid "source"
msgstr "source" msgstr "source"
#: apps/note/admin.py:128 apps/note/admin.py:156 #: apps/note/admin.py:128 apps/note/admin.py:156
#: apps/note/models/transactions.py:53 apps/note/models/transactions.py:100 #: apps/note/models/transactions.py:54 apps/note/models/transactions.py:108
msgid "destination" msgid "destination"
msgstr "destination" msgstr "destination"
@ -310,7 +310,7 @@ msgstr ""
msgid "display image" msgid "display image"
msgstr "image affichée" msgstr "image affichée"
#: apps/note/models/notes.py:53 apps/note/models/transactions.py:103 #: apps/note/models/notes.py:53 apps/note/models/transactions.py:118
msgid "created at" msgid "created at"
msgstr "créée le" msgstr "créée le"
@ -384,101 +384,106 @@ msgstr "Un alias avec un nom similaire existe déjà : {}"
msgid "You can't delete your main alias." msgid "You can't delete your main alias."
msgstr "Vous ne pouvez pas supprimer votre alias principal." msgstr "Vous ne pouvez pas supprimer votre alias principal."
#: apps/note/models/transactions.py:30 #: apps/note/models/transactions.py:31
msgid "transaction category" msgid "transaction category"
msgstr "catégorie de transaction" msgstr "catégorie de transaction"
#: apps/note/models/transactions.py:31 #: apps/note/models/transactions.py:32
msgid "transaction categories" msgid "transaction categories"
msgstr "catégories de transaction" msgstr "catégories de transaction"
#: apps/note/models/transactions.py:47 #: apps/note/models/transactions.py:48
msgid "A template with this name already exist" msgid "A template with this name already exist"
msgstr "Un modèle de transaction avec un nom similaire existe déjà." msgstr "Un modèle de transaction avec un nom similaire existe déjà."
#: apps/note/models/transactions.py:56 apps/note/models/transactions.py:111 #: apps/note/models/transactions.py:57 apps/note/models/transactions.py:126
msgid "amount" msgid "amount"
msgstr "montant" msgstr "montant"
#: apps/note/models/transactions.py:57 #: apps/note/models/transactions.py:58
msgid "in centimes" msgid "in centimes"
msgstr "en centimes" msgstr "en centimes"
#: apps/note/models/transactions.py:75 #: apps/note/models/transactions.py:76
msgid "transaction template" msgid "transaction template"
msgstr "modèle de transaction" msgstr "modèle de transaction"
#: apps/note/models/transactions.py:76 #: apps/note/models/transactions.py:77
msgid "transaction templates" msgid "transaction templates"
msgstr "modèles de transaction" msgstr "modèles de transaction"
#: apps/note/models/transactions.py:107 #: apps/note/models/transactions.py:101 apps/note/models/transactions.py:114
#: apps/note/tables.py:33 apps/note/tables.py:42
msgid "used alias"
msgstr "alias utilisé"
#: apps/note/models/transactions.py:122
msgid "quantity" msgid "quantity"
msgstr "quantité" msgstr "quantité"
#: apps/note/models/transactions.py:115 #: apps/note/models/transactions.py:130
msgid "reason" msgid "reason"
msgstr "raison" msgstr "raison"
#: apps/note/models/transactions.py:120 #: apps/note/models/transactions.py:135
msgid "valid" msgid "valid"
msgstr "valide" msgstr "valide"
#: apps/note/models/transactions.py:125 apps/note/tables.py:74 #: apps/note/models/transactions.py:140 apps/note/tables.py:95
msgid "invalidity reason" msgid "invalidity reason"
msgstr "Motif d'invalidité" msgstr "Motif d'invalidité"
#: apps/note/models/transactions.py:132 #: apps/note/models/transactions.py:147
msgid "transaction" msgid "transaction"
msgstr "transaction" msgstr "transaction"
#: apps/note/models/transactions.py:133 #: apps/note/models/transactions.py:148
msgid "transactions" msgid "transactions"
msgstr "transactions" msgstr "transactions"
#: apps/note/models/transactions.py:180 templates/base.html:83 #: apps/note/models/transactions.py:202 templates/base.html:83
#: templates/note/transaction_form.html:19 #: templates/note/transaction_form.html:19
#: templates/note/transaction_form.html:145 #: templates/note/transaction_form.html:145
msgid "Transfer" msgid "Transfer"
msgstr "Virement" msgstr "Virement"
#: apps/note/models/transactions.py:200 #: apps/note/models/transactions.py:222
msgid "Template" msgid "Template"
msgstr "Bouton" msgstr "Bouton"
#: apps/note/models/transactions.py:215 #: apps/note/models/transactions.py:237
msgid "first_name" msgid "first_name"
msgstr "Prénom" msgstr "Prénom"
#: apps/note/models/transactions.py:220 #: apps/note/models/transactions.py:242
msgid "bank" msgid "bank"
msgstr "Banque" msgstr "Banque"
#: apps/note/models/transactions.py:226 templates/note/transaction_form.html:24 #: apps/note/models/transactions.py:248 templates/note/transaction_form.html:24
msgid "Credit" msgid "Credit"
msgstr "Crédit" msgstr "Crédit"
#: apps/note/models/transactions.py:226 templates/note/transaction_form.html:28 #: apps/note/models/transactions.py:248 templates/note/transaction_form.html:28
msgid "Debit" msgid "Debit"
msgstr "Retrait" msgstr "Retrait"
#: apps/note/models/transactions.py:242 apps/note/models/transactions.py:247 #: apps/note/models/transactions.py:264 apps/note/models/transactions.py:269
msgid "membership transaction" msgid "membership transaction"
msgstr "transaction d'adhésion" msgstr "transaction d'adhésion"
#: apps/note/models/transactions.py:243 #: apps/note/models/transactions.py:265
msgid "membership transactions" msgid "membership transactions"
msgstr "transactions d'adhésion" msgstr "transactions d'adhésion"
#: apps/note/tables.py:39 #: apps/note/tables.py:57
msgid "Click to invalidate" msgid "Click to invalidate"
msgstr "Cliquez pour dévalider" msgstr "Cliquez pour dévalider"
#: apps/note/tables.py:39 #: apps/note/tables.py:57
msgid "Click to validate" msgid "Click to validate"
msgstr "Cliquez pour valider" msgstr "Cliquez pour valider"
#: apps/note/tables.py:72 #: apps/note/tables.py:93
msgid "No reason specified" msgid "No reason specified"
msgstr "Pas de motif spécifié" msgstr "Pas de motif spécifié"

View File

@ -167,7 +167,7 @@ function reset() {
function consumeAll() { function consumeAll() {
notes_display.forEach(function(note_display) { notes_display.forEach(function(note_display) {
buttons.forEach(function(button) { buttons.forEach(function(button) {
consume(note_display.id, button.dest, button.quantity * note_display.quantity, button.amount, consume(note_display.id, note_display.name, button.dest, button.quantity * note_display.quantity, button.amount,
button.name + " (" + button.category_name + ")", button.type, button.category_id, button.id); button.name + " (" + button.category_name + ")", button.type, button.category_id, button.id);
}); });
}); });
@ -176,6 +176,7 @@ function consumeAll() {
/** /**
* Create a new transaction from a button through the API. * Create a new transaction from a button through the API.
* @param source The note that paid the item (type: int) * @param source The note that paid the item (type: int)
* @param source_alias The alias used for the source (type: str)
* @param dest The note that sold the item (type: int) * @param dest The note that sold the item (type: int)
* @param quantity The quantity sold (type: int) * @param quantity The quantity sold (type: int)
* @param amount The price of one item, in cents (type: int) * @param amount The price of one item, in cents (type: int)
@ -184,7 +185,7 @@ function consumeAll() {
* @param category The category id of the button (type: int) * @param category The category id of the button (type: int)
* @param template The button id (type: int) * @param template The button id (type: int)
*/ */
function consume(source, dest, quantity, amount, reason, type, category, template) { function consume(source, source_alias, dest, quantity, amount, reason, type, category, template) {
$.post("/api/note/transaction/transaction/", $.post("/api/note/transaction/transaction/",
{ {
"csrfmiddlewaretoken": CSRF_TOKEN, "csrfmiddlewaretoken": CSRF_TOKEN,
@ -195,6 +196,7 @@ function consume(source, dest, quantity, amount, reason, type, category, templat
"polymorphic_ctype": type, "polymorphic_ctype": type,
"resourcetype": "RecurrentTransaction", "resourcetype": "RecurrentTransaction",
"source": source, "source": source,
"source_alias": source_alias,
"destination": dest, "destination": dest,
"category": category, "category": category,
"template": template "template": template
@ -210,6 +212,7 @@ function consume(source, dest, quantity, amount, reason, type, category, templat
"polymorphic_ctype": type, "polymorphic_ctype": type,
"resourcetype": "RecurrentTransaction", "resourcetype": "RecurrentTransaction",
"source": source, "source": source,
"source_alias": source_alias,
"destination": dest, "destination": dest,
"category": category, "category": category,
"template": template "template": template

View File

@ -72,7 +72,8 @@ $("#transfer").click(function() {
"polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE, "polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE,
"resourcetype": "Transaction", "resourcetype": "Transaction",
"source": user_id, "source": user_id,
"destination": dest.id "destination": dest.id,
"destination_alias": dest.name
}).done(function () { }).done(function () {
addMsg("Le transfert de " addMsg("Le transfert de "
+ pretty_money(dest.quantity * 100 * $("#amount").val()) + " de votre note " + pretty_money(dest.quantity * 100 * $("#amount").val()) + " de votre note "
@ -91,7 +92,8 @@ $("#transfer").click(function() {
"polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE, "polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE,
"resourcetype": "Transaction", "resourcetype": "Transaction",
"source": user_id, "source": user_id,
"destination": dest.id "destination": dest.id,
"destination_alias": dest.name
}).done(function () { }).done(function () {
addMsg("Le transfert de " addMsg("Le transfert de "
+ pretty_money(dest.quantity * 100 * $("#amount").val()) + " de votre note " + pretty_money(dest.quantity * 100 * $("#amount").val()) + " de votre note "
@ -121,7 +123,9 @@ $("#transfer").click(function() {
"polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE, "polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE,
"resourcetype": "Transaction", "resourcetype": "Transaction",
"source": source.id, "source": source.id,
"destination": dest.id "source_alias": source.name,
"destination": dest.id,
"destination_alias": dest.name
}).done(function () { }).done(function () {
addMsg("Le transfert de " addMsg("Le transfert de "
+ pretty_money(source.quantity * dest.quantity * 100 * $("#amount").val()) + " de la note " + source.name + pretty_money(source.quantity * dest.quantity * 100 * $("#amount").val()) + " de la note " + source.name
@ -140,7 +144,9 @@ $("#transfer").click(function() {
"polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE, "polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE,
"resourcetype": "Transaction", "resourcetype": "Transaction",
"source": source.id, "source": source.id,
"destination": dest.id "source_alias": source.name,
"destination": dest.id,
"destination_alias": dest.name
}).done(function () { }).done(function () {
addMsg("Le transfert de " addMsg("Le transfert de "
+ pretty_money(source.quantity * dest.quantity * 100 * $("#amount").val()) + " de la note " + source.name + pretty_money(source.quantity * dest.quantity * 100 * $("#amount").val()) + " de la note " + source.name
@ -186,7 +192,9 @@ $("#transfer").click(function() {
"polymorphic_ctype": SPECIAL_TRANSFER_POLYMORPHIC_CTYPE, "polymorphic_ctype": SPECIAL_TRANSFER_POLYMORPHIC_CTYPE,
"resourcetype": "SpecialTransaction", "resourcetype": "SpecialTransaction",
"source": source, "source": source,
"source_alias": source.name,
"destination": dest, "destination": dest,
"destination_alias": dest.name,
"last_name": $("#last_name").val(), "last_name": $("#last_name").val(),
"first_name": $("#first_name").val(), "first_name": $("#first_name").val(),
"bank": $("#bank").val() "bank": $("#bank").val()