Commit d60e14a3 authored by Sli's avatar Sli
Browse files

Migration from old database

parent 7588cc8f
...@@ -39,7 +39,7 @@ from accounting.models import GeneralJournal, BankAccount, ClubAccount, Operatio ...@@ -39,7 +39,7 @@ from accounting.models import GeneralJournal, BankAccount, ClubAccount, Operatio
from core.utils import resize_image from core.utils import resize_image
from club.models import Club, Membership from club.models import Club, Membership
from subscription.models import Subscription from subscription.models import Subscription
from counter.models import Customer, ProductType, Product, Counter from counter.models import Customer, ProductType, Product, Counter, Selling
from com.models import Sith, Weekmail from com.models import Sith, Weekmail
from election.models import Election, Role, Candidature, ElectionList from election.models import Election, Role, Candidature, ElectionList
from forum.models import Forum, ForumTopic from forum.models import Forum, ForumTopic
...@@ -485,6 +485,9 @@ Welcome to the wiki page! ...@@ -485,6 +485,9 @@ Welcome to the wiki page!
start=s.subscription_start) start=s.subscription_start)
s.save() s.save()
Selling(label=dcons.name, product=dcons, counter=mde, unit_price=dcons.selling_price, club=main_club,
quantity=settings.SITH_RECORD_LIMIT + 3, seller=skia, customer=krophil.customer).save()
# Add barman to counter # Add barman to counter
c = Counter.objects.get(id=2) c = Counter.objects.get(id=2)
c.sellers.add(User.objects.get(pk=krophil.pk)) c.sellers.add(User.objects.get(pk=krophil.pk))
......
...@@ -37,14 +37,18 @@ ...@@ -37,14 +37,18 @@
<h3>{% trans %}User account{% endtrans %}</h3> <h3>{% trans %}User account{% endtrans %}</h3>
<p>{% trans %}Amount: {% endtrans %}{{ customer.amount }}</p> <p>{% trans %}Amount: {% endtrans %}{{ customer.amount }}</p>
<div id="drop"> <div id="drop">
{% if customer.refillings.exists() %} {% set bought = customer.buyings.exists() %}
{% if customer.buyings.exists() %} {% set refilled = customer.refillings.exists() %}
{% if bought or refilled %}
{% if bought %}
<h5>{% trans %}Account buyings{% endtrans %}</h5> <h5>{% trans %}Account buyings{% endtrans %}</h5>
{{ monthly(buyings_month) }} {{ monthly(buyings_month) }}
{% endif %} {% endif %}
{% if refilled %}
<h5>{% trans %}Refillings{% endtrans %}</h5> <h5>{% trans %}Refillings{% endtrans %}</h5>
{{ monthly(refilling_month) }} {{ monthly(refilling_month) }}
{% endif %} {% endif %}
{% endif %}
{% if customer.user.invoices.exists() %} {% if customer.user.invoices.exists() %}
<h5>{% trans %}Eboutic invoices{% endtrans %}</h5> <h5>{% trans %}Eboutic invoices{% endtrans %}</h5>
{{ monthly(invoices_month) }} {{ monthly(invoices_month) }}
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.db import migrations, models from django.db import migrations, models
from django.conf import settings
from core.models import User
from counter.models import Customer, Product, Selling, Counter
def balance_ecocups(apps, schema_editor):
for customer in Customer.objects.all():
for selling in customer.buyings.filter(product__id__in=[settings.SITH_RECORD_PRODUCT, settings.SITH_UNRECORD_PRODUCT]).all():
if selling.product.id == settings.SITH_RECORD_PRODUCT:
customer.recorded_products -= selling.quantity
elif selling.product.id == settings.SITH_UNRECORD_PRODUCT:
customer.recorded_products += selling.quantity
if customer.recorded_products > settings.SITH_RECORD_LIMIT:
qt = customer.recorded_products - settings.SITH_RECORD_LIMIT
cons = Product.objects.get(id=settings.SITH_RECORD_PRODUCT)
Selling(label=_("Record regularization"), product=cons, unit_price=cons.selling_price,
club=cons.club, counter=Counter.objects.filter(name='Foyer').first(),
quantity=qt, seller=User.objects.get(id=0), customer=customer).save()
customer.recorded_products -= qt
customer.save()
class Migration(migrations.Migration): class Migration(migrations.Migration):
...@@ -16,4 +38,5 @@ class Migration(migrations.Migration): ...@@ -16,4 +38,5 @@ class Migration(migrations.Migration):
name='recorded_products', name='recorded_products',
field=models.IntegerField(verbose_name='recorded items', default=0), field=models.IntegerField(verbose_name='recorded items', default=0),
), ),
migrations.RunPython(balance_ecocups),
] ]
...@@ -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-07-21 18:45+0200\n" "POT-Creation-Date: 2017-08-14 03:10+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"
...@@ -19,7 +19,7 @@ msgstr "" ...@@ -19,7 +19,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:44 #: accounting/models.py:197 club/models.py:44
#: core/templates/core/base.jinja:234 counter/models.py:108 #: core/templates/core/base.jinja:234 counter/models.py:108
#: counter/models.py:134 counter/models.py:184 forum/models.py:49 #: counter/models.py:134 counter/models.py:178 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
msgid "name" msgid "name"
...@@ -67,7 +67,7 @@ msgstr "numero de compte" ...@@ -67,7 +67,7 @@ msgstr "numero de compte"
#: accounting/models.py:113 accounting/models.py:139 club/models.py:186 #: accounting/models.py:113 accounting/models.py:139 club/models.py:186
#: com/models.py:65 com/models.py:156 counter/models.py:143 #: com/models.py:65 com/models.py:156 counter/models.py:143
#: counter/models.py:185 trombi/models.py:149 #: counter/models.py:179 trombi/models.py:149
msgid "club" msgid "club"
msgstr "club" msgstr "club"
...@@ -88,12 +88,12 @@ msgstr "Compte club" ...@@ -88,12 +88,12 @@ msgstr "Compte club"
msgid "%(club_account)s on %(bank_account)s" msgid "%(club_account)s on %(bank_account)s"
msgstr "%(club_account)s sur %(bank_account)s" msgstr "%(club_account)s sur %(bank_account)s"
#: accounting/models.py:195 club/models.py:187 counter/models.py:461 #: accounting/models.py:195 club/models.py:187 counter/models.py:455
#: election/models.py:16 launderette/models.py:148 #: election/models.py:16 launderette/models.py:148
msgid "start date" msgid "start date"
msgstr "date de début" msgstr "date de début"
#: accounting/models.py:196 club/models.py:188 counter/models.py:462 #: accounting/models.py:196 club/models.py:188 counter/models.py:456
#: election/models.py:17 #: election/models.py:17
msgid "end date" msgid "end date"
msgstr "date de fin" msgstr "date de fin"
...@@ -107,7 +107,7 @@ msgid "club account" ...@@ -107,7 +107,7 @@ msgid "club account"
msgstr "compte club" msgstr "compte club"
#: accounting/models.py:200 accounting/models.py:257 counter/models.py:53 #: accounting/models.py:200 accounting/models.py:257 counter/models.py:53
#: counter/models.py:298 #: counter/models.py:292
msgid "amount" msgid "amount"
msgstr "montant" msgstr "montant"
...@@ -128,17 +128,17 @@ msgid "journal" ...@@ -128,17 +128,17 @@ msgid "journal"
msgstr "classeur" msgstr "classeur"
#: accounting/models.py:258 core/models.py:616 core/models.py:991 #: accounting/models.py:258 core/models.py:616 core/models.py:991
#: core/models.py:1032 counter/models.py:301 counter/models.py:350 #: core/models.py:1032 counter/models.py:295 counter/models.py:344
#: counter/models.py:479 eboutic/models.py:39 eboutic/models.py:73 #: counter/models.py:473 eboutic/models.py:39 eboutic/models.py:73
#: forum/models.py:239 forum/models.py:314 stock/models.py:76 #: forum/models.py:239 forum/models.py:314 stock/models.py:76
msgid "date" msgid "date"
msgstr "date" msgstr "date"
#: accounting/models.py:259 counter/models.py:480 stock/models.py:79 #: accounting/models.py:259 counter/models.py:474 stock/models.py:79
msgid "comment" msgid "comment"
msgstr "commentaire" msgstr "commentaire"
#: accounting/models.py:260 counter/models.py:302 counter/models.py:351 #: accounting/models.py:260 counter/models.py:296 counter/models.py:345
#: subscription/models.py:55 #: subscription/models.py:55
msgid "payment method" msgid "payment method"
msgstr "méthode de paiement" msgstr "méthode de paiement"
...@@ -164,7 +164,7 @@ msgid "accounting type" ...@@ -164,7 +164,7 @@ msgid "accounting type"
msgstr "type comptable" msgstr "type comptable"
#: accounting/models.py:269 accounting/models.py:371 accounting/models.py:398 #: accounting/models.py:269 accounting/models.py:371 accounting/models.py:398
#: accounting/models.py:422 counter/models.py:342 #: accounting/models.py:422 counter/models.py:336
msgid "label" msgid "label"
msgstr "étiquette" msgstr "étiquette"
...@@ -603,7 +603,7 @@ msgid "Done" ...@@ -603,7 +603,7 @@ msgid "Done"
msgstr "Effectuées" msgstr "Effectuées"
#: accounting/templates/accounting/journal_details.jinja:39 #: accounting/templates/accounting/journal_details.jinja:39
#: counter/templates/counter/cash_summary_list.jinja:37 counter/views.py:854 #: counter/templates/counter/cash_summary_list.jinja:37 counter/views.py:855
#: trombi/templates/trombi/comment.jinja:4 #: trombi/templates/trombi/comment.jinja:4
#: trombi/templates/trombi/comment.jinja:8 #: trombi/templates/trombi/comment.jinja:8
#: trombi/templates/trombi/user_tools.jinja:50 #: trombi/templates/trombi/user_tools.jinja:50
...@@ -854,7 +854,7 @@ msgstr "Vous ne pouvez pas faire de boucles dans les clubs" ...@@ -854,7 +854,7 @@ msgstr "Vous ne pouvez pas faire de boucles dans les clubs"
msgid "A club with that unix_name already exists" msgid "A club with that unix_name already exists"
msgstr "Un club avec ce nom UNIX existe déjà." msgstr "Un club avec ce nom UNIX existe déjà."
#: club/models.py:185 counter/models.py:459 counter/models.py:477 #: club/models.py:185 counter/models.py:453 counter/models.py:471
#: eboutic/models.py:38 eboutic/models.py:72 election/models.py:140 #: eboutic/models.py:38 eboutic/models.py:72 election/models.py:140
#: launderette/models.py:114 launderette/models.py:152 sas/models.py:158 #: launderette/models.py:114 launderette/models.py:152 sas/models.py:158
#: trombi/models.py:148 #: trombi/models.py:148
...@@ -1093,17 +1093,17 @@ msgstr "Choisir un utilisateur" ...@@ -1093,17 +1093,17 @@ msgstr "Choisir un utilisateur"
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:197 counter/views.py:1096 #: club/views.py:197 counter/views.py:1097
msgid "Begin date" msgid "Begin date"
msgstr "Date de début" msgstr "Date de début"
#: club/views.py:198 com/views.py:130 counter/views.py:1097 #: club/views.py:198 com/views.py:130 counter/views.py:1098
#: election/views.py:135 subscription/views.py:47 #: election/views.py:135 subscription/views.py:47
msgid "End date" msgid "End date"
msgstr "Date de fin" msgstr "Date de fin"
#: club/views.py:213 core/templates/core/user_stats.jinja:27 #: club/views.py:213 core/templates/core/user_stats.jinja:27
#: counter/views.py:1187 #: counter/views.py:1188
msgid "Product" msgid "Product"
msgstr "Produit" msgstr "Produit"
...@@ -2465,29 +2465,29 @@ msgstr "Compte de %(user_name)s" ...@@ -2465,29 +2465,29 @@ msgstr "Compte de %(user_name)s"
msgid "User account" msgid "User account"
msgstr "Compte utilisateur" msgstr "Compte utilisateur"
#: core/templates/core/user_account.jinja:42 #: core/templates/core/user_account.jinja:44
#: core/templates/core/user_account_detail.jinja:13 #: core/templates/core/user_account_detail.jinja:13
msgid "Account buyings" msgid "Account buyings"
msgstr "Achat sur compte utilisateur" msgstr "Achat sur compte utilisateur"
#: core/templates/core/user_account.jinja:45 #: core/templates/core/user_account.jinja:48
#: core/templates/core/user_account_detail.jinja:46 #: core/templates/core/user_account_detail.jinja:46
#: counter/templates/counter/cash_summary_list.jinja:17 #: counter/templates/counter/cash_summary_list.jinja:17
#: counter/templates/counter/last_ops.jinja:10 #: counter/templates/counter/last_ops.jinja:10
msgid "Refillings" msgid "Refillings"
msgstr "Rechargements" msgstr "Rechargements"
#: core/templates/core/user_account.jinja:49 #: core/templates/core/user_account.jinja:53
#: core/templates/core/user_account_detail.jinja:74 #: core/templates/core/user_account_detail.jinja:74
msgid "Eboutic invoices" msgid "Eboutic invoices"
msgstr "Facture eboutic" msgstr "Facture eboutic"
#: core/templates/core/user_account.jinja:53 #: core/templates/core/user_account.jinja:57
#: core/templates/core/user_tools.jinja:34 counter/views.py:600 #: core/templates/core/user_tools.jinja:34 counter/views.py:601
msgid "Etickets" msgid "Etickets"
msgstr "Etickets" msgstr "Etickets"
#: core/templates/core/user_account.jinja:64 #: core/templates/core/user_account.jinja:68
#: core/templates/core/user_account_detail.jinja:102 #: core/templates/core/user_account_detail.jinja:102
msgid "User has no account" msgid "User has no account"
msgstr "L'utilisateur n'a pas de compte" msgstr "L'utilisateur n'a pas de compte"
...@@ -2677,8 +2677,8 @@ msgstr "Cotisations" ...@@ -2677,8 +2677,8 @@ msgstr "Cotisations"
msgid "Subscription stats" msgid "Subscription stats"
msgstr "Statistiques de cotisation" msgstr "Statistiques de cotisation"
#: core/templates/core/user_tools.jinja:25 counter/views.py:570 #: core/templates/core/user_tools.jinja:25 counter/views.py:571
#: counter/views.py:736 #: counter/views.py:737
msgid "Counters" msgid "Counters"
msgstr "Comptoirs" msgstr "Comptoirs"
...@@ -2699,12 +2699,12 @@ msgid "Product types management" ...@@ -2699,12 +2699,12 @@ msgid "Product types management"
msgstr "Gestion des types de produit" msgstr "Gestion des types de produit"
#: core/templates/core/user_tools.jinja:32 #: core/templates/core/user_tools.jinja:32
#: counter/templates/counter/cash_summary_list.jinja:23 counter/views.py:590 #: counter/templates/counter/cash_summary_list.jinja:23 counter/views.py:591
msgid "Cash register summaries" msgid "Cash register summaries"
msgstr "Relevés de caisse" msgstr "Relevés de caisse"
#: core/templates/core/user_tools.jinja:33 #: core/templates/core/user_tools.jinja:33
#: counter/templates/counter/invoices_call.jinja:4 counter/views.py:595 #: counter/templates/counter/invoices_call.jinja:4 counter/views.py:596
msgid "Invoices call" msgid "Invoices call"
msgstr "Appels à facture" msgstr "Appels à facture"
...@@ -2871,6 +2871,10 @@ msgstr "Photos" ...@@ -2871,6 +2871,10 @@ msgstr "Photos"
msgid "User already has a profile picture" msgid "User already has a profile picture"
msgstr "L'utilisateur a déjà une photo de profil" msgstr "L'utilisateur a déjà une photo de profil"
#: counter/migrations/0013_customer_recorded_products.py:22
msgid "Record regularization"
msgstr "Régularization des consignes"
#: counter/models.py:52 #: counter/models.py:52
msgid "account id" msgid "account id"
msgstr "numéro de compte" msgstr "numéro de compte"
...@@ -2932,27 +2936,27 @@ msgstr "groupe d'achat" ...@@ -2932,27 +2936,27 @@ msgstr "groupe d'achat"
msgid "archived" msgid "archived"
msgstr "archivé" msgstr "archivé"
#: counter/models.py:152 counter/models.py:562 #: counter/models.py:152 counter/models.py:556
msgid "product" msgid "product"
msgstr "produit" msgstr "produit"
#: counter/models.py:186 #: counter/models.py:180
msgid "products" msgid "products"
msgstr "produits" msgstr "produits"
#: counter/models.py:187 #: counter/models.py:181
msgid "counter type" msgid "counter type"
msgstr "type de comptoir" msgstr "type de comptoir"
#: counter/models.py:189 #: counter/models.py:183
msgid "Bar" msgid "Bar"
msgstr "Bar" msgstr "Bar"
#: counter/models.py:189 #: counter/models.py:183
msgid "Office" msgid "Office"
msgstr "Bureau" msgstr "Bureau"
#: counter/models.py:189 counter/templates/counter/counter_list.jinja:11 #: counter/models.py:183 counter/templates/counter/counter_list.jinja:11
#: eboutic/templates/eboutic/eboutic_main.jinja:4 #: eboutic/templates/eboutic/eboutic_main.jinja:4
#: eboutic/templates/eboutic/eboutic_main.jinja:24 #: eboutic/templates/eboutic/eboutic_main.jinja:24
#: eboutic/templates/eboutic/eboutic_makecommand.jinja:8 #: eboutic/templates/eboutic/eboutic_makecommand.jinja:8
...@@ -2961,62 +2965,62 @@ msgstr "Bureau" ...@@ -2961,62 +2965,62 @@ msgstr "Bureau"
msgid "Eboutic" msgid "Eboutic"
msgstr "Eboutic" msgstr "Eboutic"
#: counter/models.py:190 #: counter/models.py:184
msgid "sellers" msgid "sellers"
msgstr "vendeurs" msgstr "vendeurs"
#: counter/models.py:193 launderette/models.py:151 #: counter/models.py:187 launderette/models.py:151
msgid "token" msgid "token"
msgstr "jeton" msgstr "jeton"
#: counter/models.py:196 counter/models.py:460 counter/models.py:478 #: counter/models.py:190 counter/models.py:454 counter/models.py:472
#: launderette/models.py:39 stock/models.py:39 #: launderette/models.py:39 stock/models.py:39
msgid "counter" msgid "counter"
msgstr "comptoir" msgstr "comptoir"
#: counter/models.py:282 #: counter/models.py:298
msgid "bank" msgid "bank"
msgstr "banque" msgstr "banque"
#: counter/models.py:284 counter/models.py:331 #: counter/models.py:300 counter/models.py:347
msgid "is validated" msgid "is validated"
msgstr "est validé" msgstr "est validé"
#: counter/models.py:287 #: counter/models.py:303
msgid "refilling" msgid "refilling"
msgstr "rechargement" msgstr "rechargement"
#: counter/models.py:324 eboutic/models.py:129 #: counter/models.py:340 eboutic/models.py:129
msgid "unit price" msgid "unit price"
msgstr "prix unitaire" msgstr "prix unitaire"
#: counter/models.py:325 counter/models.py:529 eboutic/models.py:130 #: counter/models.py:341 counter/models.py:545 eboutic/models.py:130
msgid "quantity" msgid "quantity"
msgstr "quantité" msgstr "quantité"
#: counter/models.py:330 #: counter/models.py:346
msgid "Sith account" msgid "Sith account"
msgstr "Compte utilisateur" msgstr "Compte utilisateur"
#: counter/models.py:330 sith/settings.py:357 sith/settings.py:362 #: counter/models.py:346 sith/settings.py:357 sith/settings.py:362
#: sith/settings.py:384 #: sith/settings.py:384
msgid "Credit card" msgid "Credit card"
msgstr "Carte bancaire" msgstr "Carte bancaire"
#: counter/models.py:356 #: counter/models.py:350
msgid "selling" msgid "selling"
msgstr "vente" msgstr "vente"
#: counter/models.py:375 #: counter/models.py:369
msgid "Unknown event" msgid "Unknown event"
msgstr "Événement inconnu" msgstr "Événement inconnu"
#: counter/models.py:376 #: counter/models.py:370
#, python-format #, python-format
msgid "Eticket bought for the event %(event)s" msgid "Eticket bought for the event %(event)s"
msgstr "Eticket acheté pour l'événement %(event)s" msgstr "Eticket acheté pour l'événement %(event)s"
#: counter/models.py:378 counter/models.py:390 #: counter/models.py:372 counter/models.py:384
#, python-format #, python-format
msgid "" msgid ""
"You bought an eticket for the event %(event)s.\n" "You bought an eticket for the event %(event)s.\n"
...@@ -3025,51 +3029,51 @@ msgstr "" ...@@ -3025,51 +3029,51 @@ msgstr ""
"Vous avez acheté un Eticket pour l'événement %(event)s.\n" "Vous avez acheté un Eticket pour l'événement %(event)s.\n"
"Vous pouvez le télécharger sur cette page: %(url)s" "Vous pouvez le télécharger sur cette page: %(url)s"
#: counter/models.py:463 #: counter/models.py:457
msgid "last activity date" msgid "last activity date"
msgstr "dernière activité" msgstr "dernière activité"
#: counter/models.py:466 #: counter/models.py:460
msgid "permanency" msgid "permanency"
msgstr "permanence" msgstr "permanence"
#: counter/models.py:481 #: counter/models.py:475
msgid "emptied" msgid "emptied"
msgstr "coffre vidée" msgstr "coffre vidée"
#: counter/models.py:484 #: counter/models.py:478
msgid "cash register summary" msgid "cash register summary"
msgstr "relevé de caisse" msgstr "relevé de caisse"
#: counter/models.py:549 #: counter/models.py:543
msgid "cash summary" msgid "cash summary"
msgstr "relevé" msgstr "relevé"
#: counter/models.py:550 #: counter/models.py:544
msgid "value" msgid "value"
msgstr "valeur" msgstr "valeur"
#: counter/models.py:552 #: counter/models.py:546
msgid "check" msgid "check"
msgstr "chèque" msgstr "chèque"
#: counter/models.py:555 #: counter/models.py:549
msgid "cash register summary item" msgid "cash register summary item"
msgstr "élément de relevé de caisse" msgstr "élément de relevé de caisse"
#: counter/models.py:563 #: counter/models.py:557
msgid "banner" msgid "banner"
msgstr "bannière" msgstr "bannière"
#: counter/models.py:564 #: counter/models.py:558
msgid "event date" msgid "event date"
msgstr "date de l'événement" msgstr "date de l'événement"
#: counter/models.py:565