mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 02:24:26 +00:00
Finish labels in accounting
This commit is contained in:
parent
e169e4ff6f
commit
7fdcb0c815
@ -9,5 +9,6 @@ admin.site.register(GeneralJournal)
|
|||||||
admin.site.register(AccountingType)
|
admin.site.register(AccountingType)
|
||||||
admin.site.register(SimplifiedAccountingType)
|
admin.site.register(SimplifiedAccountingType)
|
||||||
admin.site.register(Operation)
|
admin.site.register(Operation)
|
||||||
|
admin.site.register(Label)
|
||||||
|
|
||||||
|
|
||||||
|
32
accounting/migrations/0004_auto_20161005_1505.py
Normal file
32
accounting/migrations/0004_auto_20161005_1505.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('accounting', '0003_auto_20160824_2203'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Label',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True, serialize=False)),
|
||||||
|
('name', models.CharField(max_length=64, verbose_name='label')),
|
||||||
|
('club_account', models.ForeignKey(related_name='labels', verbose_name='club account', to='accounting.ClubAccount')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='operation',
|
||||||
|
name='label',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, related_name='operations', null=True, blank=True, verbose_name='label', to='accounting.Label'),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='label',
|
||||||
|
unique_together=set([('name', 'club_account')]),
|
||||||
|
),
|
||||||
|
]
|
@ -100,7 +100,16 @@ class ClubAccount(models.Model):
|
|||||||
Method to see if that object can be edited by the given user
|
Method to see if that object can be edited by the given user
|
||||||
"""
|
"""
|
||||||
m = self.club.get_membership_for(user)
|
m = self.club.get_membership_for(user)
|
||||||
if m is not None and m.role >= 7:
|
if m and m.role == 7:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def can_be_viewed_by(self, user):
|
||||||
|
"""
|
||||||
|
Method to see if that object can be viewed by the given user
|
||||||
|
"""
|
||||||
|
m = self.club.get_membership_for(user)
|
||||||
|
if m and m.role >= 7:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -149,6 +158,9 @@ class GeneralJournal(models.Model):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def can_be_viewed_by(self, user):
|
||||||
|
return self.club_account.can_be_edited_by(user)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('accounting:journal_details', kwargs={'j_id': self.id})
|
return reverse('accounting:journal_details', kwargs={'j_id': self.id})
|
||||||
|
|
||||||
@ -186,6 +198,8 @@ class Operation(models.Model):
|
|||||||
verbose_name=_("simple type"), null=True, blank=True)
|
verbose_name=_("simple type"), null=True, blank=True)
|
||||||
accounting_type = models.ForeignKey('AccountingType', related_name="operations",
|
accounting_type = models.ForeignKey('AccountingType', related_name="operations",
|
||||||
verbose_name=_("accounting type"), null=True, blank=True)
|
verbose_name=_("accounting type"), null=True, blank=True)
|
||||||
|
label = models.ForeignKey('Label', related_name="operations",
|
||||||
|
verbose_name=_("label"), null=True, blank=True, on_delete=models.SET_NULL)
|
||||||
target_type = models.CharField(_('target type'), max_length=10,
|
target_type = models.CharField(_('target type'), max_length=10,
|
||||||
choices=[('USER', _('User')), ('CLUB', _('Club')), ('ACCOUNT', _('Account')), ('COMPANY', _('Company')), ('OTHER', _('Other'))])
|
choices=[('USER', _('User')), ('CLUB', _('Club')), ('ACCOUNT', _('Account')), ('COMPANY', _('Company')), ('OTHER', _('Other'))])
|
||||||
target_id = models.IntegerField(_('target id'), null=True, blank=True)
|
target_id = models.IntegerField(_('target id'), null=True, blank=True)
|
||||||
@ -326,3 +340,26 @@ class SimplifiedAccountingType(models.Model):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.get_movement_type_display()+" - "+self.accounting_type.code+" - "+self.label
|
return self.get_movement_type_display()+" - "+self.accounting_type.code+" - "+self.label
|
||||||
|
|
||||||
|
class Label(models.Model):
|
||||||
|
"""Label allow a club to sort its operations"""
|
||||||
|
name = models.CharField(_('label'), max_length=64)
|
||||||
|
club_account = models.ForeignKey(ClubAccount, related_name="labels", verbose_name=_("club account"))
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = ('name', 'club_account')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "%s (%s)" % (self.name, self.club_account.name)
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return reverse('accounting:label_list', kwargs={'clubaccount_id': self.club_account.id})
|
||||||
|
|
||||||
|
def is_owned_by(self, user):
|
||||||
|
return self.club_account.is_owned_by(user)
|
||||||
|
|
||||||
|
def can_be_edited_by(self, user):
|
||||||
|
return self.club_account.can_be_edited_by(user)
|
||||||
|
|
||||||
|
def can_be_viewed_by(self, user):
|
||||||
|
return self.club_account.can_be_viewed_by(user)
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
{% if user.is_root and not object.journals.exists() %}
|
{% if user.is_root and not object.journals.exists() %}
|
||||||
<a href="{{ url('accounting:club_delete', c_account_id=object.id) }}">{% trans %}Delete{% endtrans %}</a>
|
<a href="{{ url('accounting:club_delete', c_account_id=object.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<p><a href="{{ url('accounting:label_new') }}?parent={{ object.id }}">{% trans %}New label{% endtrans %}</a></p>
|
||||||
|
<p><a href="{{ url('accounting:label_list', clubaccount_id=object.id) }}">{% trans %}Label list{% endtrans %}</a></p>
|
||||||
{% if not object.has_open_journal() %}
|
{% if not object.has_open_journal() %}
|
||||||
<p><a href="{{ url('accounting:journal_new') }}?parent={{ object.id }}">{% trans %}New journal{% endtrans %}</a></p>
|
<p><a href="{{ url('accounting:journal_new') }}?parent={{ object.id }}">{% trans %}New journal{% endtrans %}</a></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{% trans %}Nb{% endtrans %}</td>
|
<td>{% trans %}Nb{% endtrans %}</td>
|
||||||
<td>{% trans %}Date{% endtrans %}</td>
|
<td>{% trans %}Date{% endtrans %}</td>
|
||||||
|
<td>{% trans %}Label{% endtrans %}</td>
|
||||||
<td>{% trans %}Amount{% endtrans %}</td>
|
<td>{% trans %}Amount{% endtrans %}</td>
|
||||||
<td>{% trans %}Payment mode{% endtrans %}</td>
|
<td>{% trans %}Payment mode{% endtrans %}</td>
|
||||||
<td>{% trans %}Target{% endtrans %}</td>
|
<td>{% trans %}Target{% endtrans %}</td>
|
||||||
@ -41,6 +42,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ o.number }}</td>
|
<td>{{ o.number }}</td>
|
||||||
<td>{{ o.date }}</td>
|
<td>{{ o.date }}</td>
|
||||||
|
<td>{{ o.label or "" }}</td>
|
||||||
<td>{{ o.amount }} €</td>
|
<td>{{ o.amount }} €</td>
|
||||||
<td>{{ o.get_mode_display() }}</td>
|
<td>{{ o.get_mode_display() }}</td>
|
||||||
{% if o.target_type == "OTHER" %}
|
{% if o.target_type == "OTHER" %}
|
||||||
|
29
accounting/templates/accounting/label_list.jinja
Normal file
29
accounting/templates/accounting/label_list.jinja
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans %}Label list{% endtrans %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<p>
|
||||||
|
<a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> >
|
||||||
|
<a href="{{ url('accounting:bank_details', b_account_id=object.bank_account.id) }}">{{object.bank_account }}</a> >
|
||||||
|
<a href="{{ url('accounting:club_details', c_account_id=object.id) }}">{{ object }}</a>
|
||||||
|
</p>
|
||||||
|
<hr>
|
||||||
|
<p><a href="{{ url('accounting:club_details', c_account_id=object.id) }}">{% trans %}Back to club account{% endtrans %}</a></p>
|
||||||
|
<p><a href="{{ url('accounting:label_new') }}?parent={{ object.id }}">{% trans %}New label{% endtrans %}</a></p>
|
||||||
|
{% if object.labels.all() %}
|
||||||
|
<h3>{% trans %}Label list{% endtrans %}</h3>
|
||||||
|
<ul>
|
||||||
|
{% for l in object.labels.all() %}
|
||||||
|
<li><a href="{{ url('accounting:label_edit', label_id=l.id) }}">{{ l }}</a> -
|
||||||
|
<a href="{{ url('accounting:label_delete', label_id=l.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
{% trans %}There is no label in this club account.{% endtrans %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
@ -35,6 +35,7 @@
|
|||||||
form.simpleaccounting_type.label }}</label> {{ form.simpleaccounting_type }}</p>
|
form.simpleaccounting_type.label }}</label> {{ form.simpleaccounting_type }}</p>
|
||||||
<p>{{ form.accounting_type.errors }}<label for="{{ form.accounting_type.name }}">{{ form.accounting_type.label }}</label> {{
|
<p>{{ form.accounting_type.errors }}<label for="{{ form.accounting_type.name }}">{{ form.accounting_type.label }}</label> {{
|
||||||
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.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>
|
||||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||||
</form>
|
</form>
|
||||||
|
@ -32,6 +32,11 @@ urlpatterns = [
|
|||||||
# Companies
|
# Companies
|
||||||
url(r'^company/create$', CompanyCreateView.as_view(), name='co_new'),
|
url(r'^company/create$', CompanyCreateView.as_view(), name='co_new'),
|
||||||
url(r'^company/(?P<co_id>[0-9]+)$', CompanyEditView.as_view(), name='co_edit'),
|
url(r'^company/(?P<co_id>[0-9]+)$', CompanyEditView.as_view(), name='co_edit'),
|
||||||
|
# Labels
|
||||||
|
url(r'^label/new$', LabelCreateView.as_view(), name='label_new'),
|
||||||
|
url(r'^label/(?P<clubaccount_id>[0-9]+)$', LabelListView.as_view(), name='label_list'),
|
||||||
|
url(r'^label/(?P<label_id>[0-9]+)/edit$', LabelEditView.as_view(), name='label_edit'),
|
||||||
|
url(r'^label/(?P<label_id>[0-9]+)/delete$', LabelDeleteView.as_view(), name='label_delete'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ from ajax_select.fields import AutoCompleteSelectField, AutoCompleteSelectMultip
|
|||||||
|
|
||||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin
|
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin
|
||||||
from core.views.forms import SelectFile, SelectDate
|
from core.views.forms import SelectFile, SelectDate
|
||||||
from accounting.models import BankAccount, ClubAccount, GeneralJournal, Operation, AccountingType, Company, SimplifiedAccountingType
|
from accounting.models import BankAccount, ClubAccount, GeneralJournal, Operation, AccountingType, Company, SimplifiedAccountingType, Label
|
||||||
|
|
||||||
# Main accounting view
|
# Main accounting view
|
||||||
|
|
||||||
@ -196,7 +196,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', 'done']
|
'cheque_number', 'invoice', 'simpleaccounting_type', 'accounting_type', 'label', 'done']
|
||||||
widgets = {
|
widgets = {
|
||||||
'journal': HiddenInput,
|
'journal': HiddenInput,
|
||||||
'target_id': HiddenInput,
|
'target_id': HiddenInput,
|
||||||
@ -210,6 +210,7 @@ class OperationForm(forms.ModelForm):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(OperationForm, self).__init__(*args, **kwargs)
|
super(OperationForm, self).__init__(*args, **kwargs)
|
||||||
|
self.fields['label'].queryset = self.instance.journal.club_account.labels.order_by('name').all()
|
||||||
if self.instance.target_type == "USER":
|
if self.instance.target_type == "USER":
|
||||||
self.fields['user'].initial = self.instance.target_id
|
self.fields['user'].initial = self.instance.target_id
|
||||||
elif self.instance.target_type == "ACCOUNT":
|
elif self.instance.target_type == "ACCOUNT":
|
||||||
@ -316,3 +317,39 @@ class CompanyEditView(CanCreateMixin, UpdateView):
|
|||||||
fields = ['name']
|
fields = ['name']
|
||||||
template_name = 'core/edit.jinja'
|
template_name = 'core/edit.jinja'
|
||||||
|
|
||||||
|
# Label views
|
||||||
|
|
||||||
|
class LabelListView(CanViewMixin, DetailView):
|
||||||
|
model = ClubAccount
|
||||||
|
pk_url_kwarg = "clubaccount_id"
|
||||||
|
template_name = 'accounting/label_list.jinja'
|
||||||
|
|
||||||
|
class LabelCreateView(CanEditMixin, CreateView): # FIXME we need to check the rights before creating the object
|
||||||
|
model = Label
|
||||||
|
form_class = modelform_factory(Label, fields=['name', 'club_account'], widgets={
|
||||||
|
'club_account': HiddenInput,
|
||||||
|
})
|
||||||
|
template_name = 'core/create.jinja'
|
||||||
|
|
||||||
|
def get_initial(self):
|
||||||
|
ret = super(LabelCreateView, self).get_initial()
|
||||||
|
if 'parent' in self.request.GET.keys():
|
||||||
|
obj = ClubAccount.objects.filter(id=int(self.request.GET['parent'])).first()
|
||||||
|
if obj is not None:
|
||||||
|
ret['club_account'] = obj.id
|
||||||
|
return ret
|
||||||
|
|
||||||
|
class LabelEditView(CanEditMixin, UpdateView):
|
||||||
|
model = Label
|
||||||
|
pk_url_kwarg = "label_id"
|
||||||
|
fields = ['name']
|
||||||
|
template_name = 'core/edit.jinja'
|
||||||
|
|
||||||
|
class LabelDeleteView(CanEditMixin, DeleteView):
|
||||||
|
model = Label
|
||||||
|
pk_url_kwarg = "label_id"
|
||||||
|
template_name = 'core/delete_confirm.jinja'
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return self.object.get_absolute_url()
|
||||||
|
|
||||||
|
19
counter/migrations/0011_auto_20161004_2039.py
Normal file
19
counter/migrations/0011_auto_20161004_2039.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('counter', '0010_auto_20161003_1900'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='eticket',
|
||||||
|
name='banner',
|
||||||
|
field=models.ImageField(null=True, verbose_name='banner', blank=True, upload_to='etickets'),
|
||||||
|
),
|
||||||
|
]
|
Binary file not shown.
@ -6,7 +6,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2016-10-03 19:24+0200\n"
|
"POT-Creation-Date: 2016-10-05 11:46+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"
|
||||||
@ -17,7 +17,7 @@ msgstr ""
|
|||||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
|
|
||||||
#: accounting/models.py:36 accounting/models.py:55 accounting/models.py:82
|
#: accounting/models.py:36 accounting/models.py:55 accounting/models.py:82
|
||||||
#: accounting/models.py:132 club/models.py:19 counter/models.py:62
|
#: accounting/models.py:141 club/models.py:19 counter/models.py:62
|
||||||
#: counter/models.py:87 counter/models.py:122 launderette/models.py:15
|
#: counter/models.py:87 counter/models.py:122 launderette/models.py:15
|
||||||
#: launderette/models.py:60 launderette/models.py:85
|
#: launderette/models.py:60 launderette/models.py:85
|
||||||
msgid "name"
|
msgid "name"
|
||||||
@ -80,89 +80,94 @@ msgstr "compte en banque"
|
|||||||
msgid "Club account"
|
msgid "Club account"
|
||||||
msgstr "Compte club"
|
msgstr "Compte club"
|
||||||
|
|
||||||
#: accounting/models.py:123
|
#: accounting/models.py:132
|
||||||
#, python-format
|
#, python-format
|
||||||
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:130 club/models.py:146 counter/models.py:341
|
#: accounting/models.py:139 club/models.py:146 counter/models.py:341
|
||||||
#: launderette/models.py:122
|
#: launderette/models.py:122
|
||||||
msgid "start date"
|
msgid "start date"
|
||||||
msgstr "date de début"
|
msgstr "date de début"
|
||||||
|
|
||||||
#: accounting/models.py:131 club/models.py:147 counter/models.py:342
|
#: accounting/models.py:140 club/models.py:147 counter/models.py:342
|
||||||
msgid "end date"
|
msgid "end date"
|
||||||
msgstr "date de fin"
|
msgstr "date de fin"
|
||||||
|
|
||||||
#: accounting/models.py:133
|
#: accounting/models.py:142
|
||||||
msgid "is closed"
|
msgid "is closed"
|
||||||
msgstr "est fermé"
|
msgstr "est fermé"
|
||||||
|
|
||||||
#: accounting/models.py:134
|
#: accounting/models.py:143 accounting/models.py:346
|
||||||
msgid "club account"
|
msgid "club account"
|
||||||
msgstr "compte club"
|
msgstr "compte club"
|
||||||
|
|
||||||
#: accounting/models.py:135 accounting/models.py:178 counter/models.py:27
|
#: accounting/models.py:144 accounting/models.py:190 counter/models.py:27
|
||||||
#: counter/models.py:226
|
#: counter/models.py:226
|
||||||
msgid "amount"
|
msgid "amount"
|
||||||
msgstr "montant"
|
msgstr "montant"
|
||||||
|
|
||||||
#: accounting/models.py:136
|
#: accounting/models.py:145
|
||||||
msgid "effective_amount"
|
msgid "effective_amount"
|
||||||
msgstr "montant effectif"
|
msgstr "montant effectif"
|
||||||
|
|
||||||
#: accounting/models.py:139
|
#: accounting/models.py:148
|
||||||
msgid "General journal"
|
msgid "General journal"
|
||||||
msgstr "Classeur"
|
msgstr "Classeur"
|
||||||
|
|
||||||
#: accounting/models.py:176
|
#: accounting/models.py:188
|
||||||
msgid "number"
|
msgid "number"
|
||||||
msgstr "numéro"
|
msgstr "numéro"
|
||||||
|
|
||||||
#: accounting/models.py:177
|
#: accounting/models.py:189
|
||||||
msgid "journal"
|
msgid "journal"
|
||||||
msgstr "classeur"
|
msgstr "classeur"
|
||||||
|
|
||||||
#: accounting/models.py:179 core/models.py:479 core/models.py:757
|
#: accounting/models.py:191 core/models.py:479 core/models.py:757
|
||||||
#: counter/models.py:229 counter/models.py:272 counter/models.py:358
|
#: counter/models.py:229 counter/models.py:272 counter/models.py:358
|
||||||
#: eboutic/models.py:15 eboutic/models.py:48
|
#: eboutic/models.py:15 eboutic/models.py:48
|
||||||
msgid "date"
|
msgid "date"
|
||||||
msgstr "date"
|
msgstr "date"
|
||||||
|
|
||||||
#: accounting/models.py:180 counter/models.py:359
|
#: accounting/models.py:192 counter/models.py:359
|
||||||
msgid "comment"
|
msgid "comment"
|
||||||
msgstr "commentaire"
|
msgstr "commentaire"
|
||||||
|
|
||||||
#: accounting/models.py:181 counter/models.py:230 counter/models.py:273
|
#: accounting/models.py:193 counter/models.py:230 counter/models.py:273
|
||||||
#: subscription/models.py:57
|
#: subscription/models.py:57
|
||||||
msgid "payment method"
|
msgid "payment method"
|
||||||
msgstr "méthode de paiement"
|
msgstr "méthode de paiement"
|
||||||
|
|
||||||
#: accounting/models.py:182
|
#: accounting/models.py:194
|
||||||
msgid "cheque number"
|
msgid "cheque number"
|
||||||
msgstr "numéro de chèque"
|
msgstr "numéro de chèque"
|
||||||
|
|
||||||
#: accounting/models.py:183 eboutic/models.py:116
|
#: accounting/models.py:195 eboutic/models.py:116
|
||||||
msgid "invoice"
|
msgid "invoice"
|
||||||
msgstr "facture"
|
msgstr "facture"
|
||||||
|
|
||||||
#: accounting/models.py:184
|
#: accounting/models.py:196
|
||||||
msgid "is done"
|
msgid "is done"
|
||||||
msgstr "est fait"
|
msgstr "est fait"
|
||||||
|
|
||||||
#: accounting/models.py:186
|
#: accounting/models.py:198
|
||||||
msgid "simple type"
|
msgid "simple type"
|
||||||
msgstr "type simplifié"
|
msgstr "type simplifié"
|
||||||
|
|
||||||
#: accounting/models.py:188 accounting/models.py:287
|
#: accounting/models.py:200 accounting/models.py:301
|
||||||
msgid "accounting type"
|
msgid "accounting type"
|
||||||
msgstr "type comptable"
|
msgstr "type comptable"
|
||||||
|
|
||||||
#: accounting/models.py:189
|
#: accounting/models.py:202 accounting/models.py:296 accounting/models.py:322
|
||||||
|
#: accounting/models.py:345 counter/models.py:264
|
||||||
|
msgid "label"
|
||||||
|
msgstr "intitulé"
|
||||||
|
|
||||||
|
#: accounting/models.py:203
|
||||||
msgid "target type"
|
msgid "target type"
|
||||||
msgstr "type de cible"
|
msgstr "type de cible"
|
||||||
|
|
||||||
#: accounting/models.py:190 club/templates/club/club_members.jinja:8
|
#: accounting/models.py:204 club/templates/club/club_members.jinja:8
|
||||||
#: club/templates/club/club_old_members.jinja:8
|
#: club/templates/club/club_old_members.jinja:8
|
||||||
#: counter/templates/counter/cash_summary_list.jinja:27
|
#: counter/templates/counter/cash_summary_list.jinja:27
|
||||||
#: counter/templates/counter/stats.jinja:15
|
#: counter/templates/counter/stats.jinja:15
|
||||||
@ -170,36 +175,36 @@ msgstr "type de cible"
|
|||||||
msgid "User"
|
msgid "User"
|
||||||
msgstr "Utilisateur"
|
msgstr "Utilisateur"
|
||||||
|
|
||||||
#: accounting/models.py:190 club/templates/club/club_detail.jinja:5
|
#: accounting/models.py:204 club/templates/club/club_detail.jinja:5
|
||||||
#: counter/templates/counter/invoices_call.jinja:20
|
#: counter/templates/counter/invoices_call.jinja:20
|
||||||
msgid "Club"
|
msgid "Club"
|
||||||
msgstr "Club"
|
msgstr "Club"
|
||||||
|
|
||||||
#: accounting/models.py:190 core/views/user.py:167
|
#: accounting/models.py:204 core/views/user.py:167
|
||||||
msgid "Account"
|
msgid "Account"
|
||||||
msgstr "Compte"
|
msgstr "Compte"
|
||||||
|
|
||||||
#: accounting/models.py:190
|
#: accounting/models.py:204
|
||||||
msgid "Company"
|
msgid "Company"
|
||||||
msgstr "Entreprise"
|
msgstr "Entreprise"
|
||||||
|
|
||||||
#: accounting/models.py:190 sith/settings.py:279
|
#: accounting/models.py:204 sith/settings.py:279
|
||||||
msgid "Other"
|
msgid "Other"
|
||||||
msgstr "Autre"
|
msgstr "Autre"
|
||||||
|
|
||||||
#: accounting/models.py:191
|
#: accounting/models.py:205
|
||||||
msgid "target id"
|
msgid "target id"
|
||||||
msgstr "id de la cible"
|
msgstr "id de la cible"
|
||||||
|
|
||||||
#: accounting/models.py:192
|
#: accounting/models.py:206
|
||||||
msgid "target label"
|
msgid "target label"
|
||||||
msgstr "nom de la cible"
|
msgstr "nom de la cible"
|
||||||
|
|
||||||
#: accounting/models.py:193
|
#: accounting/models.py:207
|
||||||
msgid "linked operation"
|
msgid "linked operation"
|
||||||
msgstr "opération liée"
|
msgstr "opération liée"
|
||||||
|
|
||||||
#: accounting/models.py:209
|
#: accounting/models.py:223
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"The date can not be before the start date of the journal, which is\n"
|
"The date can not be before the start date of the journal, which is\n"
|
||||||
@ -208,16 +213,16 @@ msgstr ""
|
|||||||
"La date ne peut pas être avant la date de début du journal, qui est\n"
|
"La date ne peut pas être avant la date de début du journal, qui est\n"
|
||||||
"%(start_date)s."
|
"%(start_date)s."
|
||||||
|
|
||||||
#: accounting/models.py:212
|
#: accounting/models.py:226
|
||||||
msgid "Target does not exists"
|
msgid "Target does not exists"
|
||||||
msgstr "La cible n'existe pas."
|
msgstr "La cible n'existe pas."
|
||||||
|
|
||||||
#: accounting/models.py:214
|
#: accounting/models.py:228
|
||||||
msgid "Please add a target label if you set no existing target"
|
msgid "Please add a target label if you set no existing target"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Merci d'ajouter un nom de cible si vous ne spécifiez pas de cible existante"
|
"Merci d'ajouter un nom de cible si vous ne spécifiez pas de cible existante"
|
||||||
|
|
||||||
#: accounting/models.py:216
|
#: accounting/models.py:230
|
||||||
msgid ""
|
msgid ""
|
||||||
"You need to provide ether a simplified accounting type or a standard "
|
"You need to provide ether a simplified accounting type or a standard "
|
||||||
"accounting type"
|
"accounting type"
|
||||||
@ -225,39 +230,35 @@ msgstr ""
|
|||||||
"Vous devez fournir soit un type comptable simplifié ou un type comptable "
|
"Vous devez fournir soit un type comptable simplifié ou un type comptable "
|
||||||
"standard"
|
"standard"
|
||||||
|
|
||||||
#: accounting/models.py:277 counter/models.py:91
|
#: accounting/models.py:291 counter/models.py:91
|
||||||
msgid "code"
|
msgid "code"
|
||||||
msgstr "code"
|
msgstr "code"
|
||||||
|
|
||||||
#: accounting/models.py:279
|
#: accounting/models.py:293
|
||||||
msgid "An accounting type code contains only numbers"
|
msgid "An accounting type code contains only numbers"
|
||||||
msgstr "Un code comptable ne contient que des numéros"
|
msgstr "Un code comptable ne contient que des numéros"
|
||||||
|
|
||||||
#: accounting/models.py:282 accounting/models.py:308 counter/models.py:264
|
#: accounting/models.py:297
|
||||||
msgid "label"
|
|
||||||
msgstr "intitulé"
|
|
||||||
|
|
||||||
#: accounting/models.py:283
|
|
||||||
msgid "movement type"
|
msgid "movement type"
|
||||||
msgstr "type de mouvement"
|
msgstr "type de mouvement"
|
||||||
|
|
||||||
#: accounting/models.py:283
|
#: accounting/models.py:297
|
||||||
msgid "Credit"
|
msgid "Credit"
|
||||||
msgstr "Crédit"
|
msgstr "Crédit"
|
||||||
|
|
||||||
#: accounting/models.py:283
|
#: accounting/models.py:297
|
||||||
msgid "Debit"
|
msgid "Debit"
|
||||||
msgstr "Débit"
|
msgstr "Débit"
|
||||||
|
|
||||||
#: accounting/models.py:284
|
#: accounting/models.py:298
|
||||||
msgid "Neutral"
|
msgid "Neutral"
|
||||||
msgstr "Neutre"
|
msgstr "Neutre"
|
||||||
|
|
||||||
#: accounting/models.py:310
|
#: accounting/models.py:324
|
||||||
msgid "simplified accounting types"
|
msgid "simplified accounting types"
|
||||||
msgstr "type simplifié"
|
msgstr "type simplifié"
|
||||||
|
|
||||||
#: accounting/models.py:313
|
#: accounting/models.py:327
|
||||||
msgid "simplified type"
|
msgid "simplified type"
|
||||||
msgstr "type simplifié"
|
msgstr "type simplifié"
|
||||||
|
|
||||||
@ -271,6 +272,7 @@ msgstr "Liste des types comptable"
|
|||||||
#: accounting/templates/accounting/bank_account_list.jinja:9
|
#: accounting/templates/accounting/bank_account_list.jinja:9
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:9
|
#: accounting/templates/accounting/club_account_details.jinja:9
|
||||||
#: accounting/templates/accounting/journal_details.jinja:9
|
#: accounting/templates/accounting/journal_details.jinja:9
|
||||||
|
#: accounting/templates/accounting/label_list.jinja:9
|
||||||
#: accounting/templates/accounting/operation_edit.jinja:9
|
#: accounting/templates/accounting/operation_edit.jinja:9
|
||||||
#: accounting/templates/accounting/simplifiedaccountingtype_list.jinja:9
|
#: accounting/templates/accounting/simplifiedaccountingtype_list.jinja:9
|
||||||
#: core/templates/core/user_tools.jinja:42
|
#: core/templates/core/user_tools.jinja:42
|
||||||
@ -298,6 +300,7 @@ msgstr "Compte en banque : "
|
|||||||
|
|
||||||
#: accounting/templates/accounting/bank_account_details.jinja:15
|
#: accounting/templates/accounting/bank_account_details.jinja:15
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:16
|
#: accounting/templates/accounting/club_account_details.jinja:16
|
||||||
|
#: accounting/templates/accounting/label_list.jinja:21
|
||||||
#: club/templates/club/club_sellings.jinja:48
|
#: club/templates/club/club_sellings.jinja:48
|
||||||
#: core/templates/core/file_detail.jinja:43
|
#: core/templates/core/file_detail.jinja:43
|
||||||
#: core/templates/core/group_list.jinja:13 core/templates/core/macros.jinja:61
|
#: core/templates/core/group_list.jinja:13 core/templates/core/macros.jinja:61
|
||||||
@ -329,7 +332,7 @@ 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:53
|
#: accounting/templates/accounting/club_account_details.jinja:55
|
||||||
#: accounting/templates/accounting/journal_details.jinja:66 club/views.py:53
|
#: accounting/templates/accounting/journal_details.jinja:66 club/views.py:53
|
||||||
#: core/templates/core/file.jinja:38 core/templates/core/page.jinja:31
|
#: core/templates/core/file.jinja:38 core/templates/core/page.jinja:31
|
||||||
#: core/templates/core/user_tools.jinja:35 core/views/user.py:151
|
#: core/templates/core/user_tools.jinja:35 core/views/user.py:151
|
||||||
@ -367,28 +370,39 @@ msgstr "Il n'y a pas de comptes dans ce site web."
|
|||||||
msgid "Club account:"
|
msgid "Club account:"
|
||||||
msgstr "Compte club : "
|
msgstr "Compte club : "
|
||||||
|
|
||||||
|
#: accounting/templates/accounting/club_account_details.jinja:18
|
||||||
|
#: accounting/templates/accounting/label_list.jinja:15
|
||||||
|
msgid "New label"
|
||||||
|
msgstr "Nouvelle étiquette"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:19
|
#: accounting/templates/accounting/club_account_details.jinja:19
|
||||||
|
#: accounting/templates/accounting/label_list.jinja:4
|
||||||
|
#: accounting/templates/accounting/label_list.jinja:17
|
||||||
|
msgid "Label list"
|
||||||
|
msgstr "Liste des étiquettes"
|
||||||
|
|
||||||
|
#: accounting/templates/accounting/club_account_details.jinja:21
|
||||||
msgid "New journal"
|
msgid "New journal"
|
||||||
msgstr "Nouveau classeur"
|
msgstr "Nouveau classeur"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:21
|
#: accounting/templates/accounting/club_account_details.jinja:23
|
||||||
msgid "You can not create new journal while you still have one opened"
|
msgid "You can not create new journal while you still have one opened"
|
||||||
msgstr "Vous ne pouvez pas créer de journal tant qu'il y en a un d'ouvert"
|
msgstr "Vous ne pouvez pas créer de journal tant qu'il y en a un d'ouvert"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:26
|
#: accounting/templates/accounting/club_account_details.jinja:28
|
||||||
#: launderette/templates/launderette/launderette_admin.jinja:43
|
#: launderette/templates/launderette/launderette_admin.jinja:43
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Nom"
|
msgstr "Nom"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:27
|
#: accounting/templates/accounting/club_account_details.jinja:29
|
||||||
msgid "Start"
|
msgid "Start"
|
||||||
msgstr "Début"
|
msgstr "Début"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:28
|
#: accounting/templates/accounting/club_account_details.jinja:30
|
||||||
msgid "End"
|
msgid "End"
|
||||||
msgstr "Fin"
|
msgstr "Fin"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:29
|
#: accounting/templates/accounting/club_account_details.jinja:31
|
||||||
#: accounting/templates/accounting/journal_details.jinja:28
|
#: accounting/templates/accounting/journal_details.jinja:28
|
||||||
#: core/templates/core/user_account_detail.jinja:20
|
#: core/templates/core/user_account_detail.jinja:20
|
||||||
#: core/templates/core/user_account_detail.jinja:81
|
#: core/templates/core/user_account_detail.jinja:81
|
||||||
@ -396,30 +410,30 @@ msgstr "Fin"
|
|||||||
msgid "Amount"
|
msgid "Amount"
|
||||||
msgstr "Montant"
|
msgstr "Montant"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:30
|
#: accounting/templates/accounting/club_account_details.jinja:32
|
||||||
msgid "Effective amount"
|
msgid "Effective amount"
|
||||||
msgstr "Montant effectif"
|
msgstr "Montant effectif"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:31
|
#: accounting/templates/accounting/club_account_details.jinja:33
|
||||||
msgid "Closed"
|
msgid "Closed"
|
||||||
msgstr "Fermé"
|
msgstr "Fermé"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:32
|
#: accounting/templates/accounting/club_account_details.jinja:34
|
||||||
#: accounting/templates/accounting/journal_details.jinja:36
|
#: accounting/templates/accounting/journal_details.jinja:36
|
||||||
msgid "Actions"
|
msgid "Actions"
|
||||||
msgstr "Actions"
|
msgstr "Actions"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:48
|
#: accounting/templates/accounting/club_account_details.jinja:50
|
||||||
#: accounting/templates/accounting/journal_details.jinja:54
|
#: accounting/templates/accounting/journal_details.jinja:54
|
||||||
msgid "Yes"
|
msgid "Yes"
|
||||||
msgstr "Oui"
|
msgstr "Oui"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:50
|
#: accounting/templates/accounting/club_account_details.jinja:52
|
||||||
#: accounting/templates/accounting/journal_details.jinja:56
|
#: accounting/templates/accounting/journal_details.jinja:56
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr "Non"
|
msgstr "Non"
|
||||||
|
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:52
|
#: accounting/templates/accounting/club_account_details.jinja:54
|
||||||
#: core/templates/core/file.jinja:36 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"
|
||||||
@ -493,13 +507,21 @@ msgstr "Commentaire"
|
|||||||
msgid "File"
|
msgid "File"
|
||||||
msgstr "Fichier"
|
msgstr "Fichier"
|
||||||
|
|
||||||
|
#: accounting/templates/accounting/label_list.jinja:14
|
||||||
|
msgid "Back to club account"
|
||||||
|
msgstr "Retour au compte club"
|
||||||
|
|
||||||
|
#: accounting/templates/accounting/label_list.jinja:26
|
||||||
|
msgid "There is no label in this club account."
|
||||||
|
msgstr "Il n'y a pas d'étiquette dans ce compte club."
|
||||||
|
|
||||||
#: accounting/templates/accounting/operation_edit.jinja:4
|
#: accounting/templates/accounting/operation_edit.jinja:4
|
||||||
#: accounting/templates/accounting/operation_edit.jinja:13
|
#: accounting/templates/accounting/operation_edit.jinja:13
|
||||||
#: accounting/templates/accounting/operation_edit.jinja:16
|
#: accounting/templates/accounting/operation_edit.jinja:16
|
||||||
msgid "Edit operation"
|
msgid "Edit operation"
|
||||||
msgstr "Éditer l'opération"
|
msgstr "Éditer l'opération"
|
||||||
|
|
||||||
#: accounting/templates/accounting/operation_edit.jinja:39
|
#: accounting/templates/accounting/operation_edit.jinja:40
|
||||||
#: core/templates/core/create.jinja:12 core/templates/core/edit.jinja:12
|
#: core/templates/core/create.jinja:12 core/templates/core/edit.jinja:12
|
||||||
#: core/templates/core/file_edit.jinja:8 core/templates/core/page_prop.jinja:8
|
#: core/templates/core/file_edit.jinja:8 core/templates/core/page_prop.jinja:8
|
||||||
#: core/templates/core/pagerev_edit.jinja:24
|
#: core/templates/core/pagerev_edit.jinja:24
|
||||||
@ -581,7 +603,8 @@ msgstr "L'utilisateur est déjà membre de ce club"
|
|||||||
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"
|
||||||
|
|
||||||
@ -685,7 +708,7 @@ msgstr "Client"
|
|||||||
#: core/templates/core/user_account_detail.jinja:49
|
#: core/templates/core/user_account_detail.jinja:49
|
||||||
#: counter/templates/counter/last_ops.jinja:42
|
#: counter/templates/counter/last_ops.jinja:42
|
||||||
msgid "Label"
|
msgid "Label"
|
||||||
msgstr "Intitulé"
|
msgstr "Étiquette"
|
||||||
|
|
||||||
#: club/templates/club/club_sellings.jinja:23
|
#: club/templates/club/club_sellings.jinja:23
|
||||||
#: core/templates/core/user_account_detail.jinja:50
|
#: core/templates/core/user_account_detail.jinja:50
|
||||||
@ -1371,11 +1394,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 : "
|
||||||
|
|
||||||
@ -1586,7 +1611,8 @@ msgstr "Résultat de la recherche"
|
|||||||
msgid "Users"
|
msgid "Users"
|
||||||
msgstr "Utilisateurs"
|
msgstr "Utilisateurs"
|
||||||
|
|
||||||
#: core/templates/core/search.jinja:18 counter/templates/counter/stats.jinja:17
|
#: core/templates/core/search.jinja:18
|
||||||
|
#: counter/templates/counter/stats.jinja:17
|
||||||
msgid "Clubs"
|
msgid "Clubs"
|
||||||
msgstr "Clubs"
|
msgstr "Clubs"
|
||||||
|
|
||||||
|
38
migrate.py
38
migrate.py
@ -24,7 +24,7 @@ from club.models import Club, Membership
|
|||||||
from counter.models import Customer, Counter, Selling, Refilling, Product, ProductType, Permanency, Eticket
|
from counter.models import Customer, Counter, Selling, Refilling, Product, ProductType, Permanency, Eticket
|
||||||
from subscription.models import Subscription, Subscriber
|
from subscription.models import Subscription, Subscriber
|
||||||
from eboutic.models import Invoice, InvoiceItem
|
from eboutic.models import Invoice, InvoiceItem
|
||||||
from accounting.models import BankAccount, ClubAccount, GeneralJournal, Operation, AccountingType, Company, SimplifiedAccountingType
|
from accounting.models import BankAccount, ClubAccount, GeneralJournal, Operation, AccountingType, Company, SimplifiedAccountingType, Label
|
||||||
|
|
||||||
db = MySQLdb.connect(**settings.OLD_MYSQL_INFOS)
|
db = MySQLdb.connect(**settings.OLD_MYSQL_INFOS)
|
||||||
start = datetime.datetime.now()
|
start = datetime.datetime.now()
|
||||||
@ -839,6 +839,30 @@ def migrate_accounting():
|
|||||||
print("Simple accounting types migrated at %s" % datetime.datetime.now())
|
print("Simple accounting types migrated at %s" % datetime.datetime.now())
|
||||||
print("Running time: %s" % (datetime.datetime.now()-start))
|
print("Running time: %s" % (datetime.datetime.now()-start))
|
||||||
|
|
||||||
|
def migrate_labels():
|
||||||
|
cur = db.cursor(MySQLdb.cursors.SSDictCursor)
|
||||||
|
cur.execute("""
|
||||||
|
SELECT *
|
||||||
|
FROM cpta_libelle
|
||||||
|
WHERE id_asso IS NOT NULL
|
||||||
|
""")
|
||||||
|
Label.objects.all().delete()
|
||||||
|
print("Labels deleted")
|
||||||
|
for r in cur:
|
||||||
|
try:
|
||||||
|
club_accounts = ClubAccount.objects.filter(club__id=r['id_asso']).all()
|
||||||
|
for ca in club_accounts:
|
||||||
|
new = Label(
|
||||||
|
club_account=ca,
|
||||||
|
name=to_unicode(r['nom_libelle']),
|
||||||
|
)
|
||||||
|
new.save()
|
||||||
|
except Exception as e:
|
||||||
|
print("FAIL to migrate label: %s" % (repr(e)))
|
||||||
|
cur.close()
|
||||||
|
print("Labels migrated at %s" % datetime.datetime.now())
|
||||||
|
print("Running time: %s" % (datetime.datetime.now()-start))
|
||||||
|
|
||||||
def migrate_operations():
|
def migrate_operations():
|
||||||
MODE = {
|
MODE = {
|
||||||
1: "CHECK",
|
1: "CHECK",
|
||||||
@ -860,6 +884,8 @@ def migrate_accounting():
|
|||||||
FROM cpta_operation op
|
FROM cpta_operation op
|
||||||
LEFT JOIN cpta_op_clb clb
|
LEFT JOIN cpta_op_clb clb
|
||||||
ON op.id_opclb = clb.id_opclb
|
ON op.id_opclb = clb.id_opclb
|
||||||
|
LEFT JOIN cpta_libelle lab
|
||||||
|
ON op.id_libelle = lab.id_libelle
|
||||||
""")
|
""")
|
||||||
Operation.objects.all().delete()
|
Operation.objects.all().delete()
|
||||||
print("Operation deleted")
|
print("Operation deleted")
|
||||||
@ -867,6 +893,7 @@ def migrate_accounting():
|
|||||||
try:
|
try:
|
||||||
simple_type = None
|
simple_type = None
|
||||||
accounting_type = None
|
accounting_type = None
|
||||||
|
label = None
|
||||||
if r['id_opclb']:
|
if r['id_opclb']:
|
||||||
simple_type = SimplifiedAccountingType.objects.filter(id=r['id_opclb']).first()
|
simple_type = SimplifiedAccountingType.objects.filter(id=r['id_opclb']).first()
|
||||||
if r['id_opstd']:
|
if r['id_opstd']:
|
||||||
@ -876,6 +903,8 @@ def migrate_accounting():
|
|||||||
if not accounting_type:
|
if not accounting_type:
|
||||||
accounting_type = AccountingType.objects.filter(movement_type=MOVEMENT_TYPE[r['type_mouvement']]).first()
|
accounting_type = AccountingType.objects.filter(movement_type=MOVEMENT_TYPE[r['type_mouvement']]).first()
|
||||||
journal = GeneralJournal.objects.filter(id=r['id_classeur']).first()
|
journal = GeneralJournal.objects.filter(id=r['id_classeur']).first()
|
||||||
|
if r['id_libelle']:
|
||||||
|
label = journal.club_account.labels.filter(name=to_unicode(r['nom_libelle'])).first()
|
||||||
def get_target_type():
|
def get_target_type():
|
||||||
if r['id_utilisateur']:
|
if r['id_utilisateur']:
|
||||||
return "USER"
|
return "USER"
|
||||||
@ -901,6 +930,7 @@ def migrate_accounting():
|
|||||||
target_type=get_target_type(),
|
target_type=get_target_type(),
|
||||||
target_id=get_target_id(),
|
target_id=get_target_id(),
|
||||||
target_label="-",
|
target_label="-",
|
||||||
|
label=label,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
new.clean()
|
new.clean()
|
||||||
@ -940,6 +970,7 @@ def migrate_accounting():
|
|||||||
migrate_simpleaccounting_types()
|
migrate_simpleaccounting_types()
|
||||||
migrate_bank_accounts()
|
migrate_bank_accounts()
|
||||||
migrate_club_accounts()
|
migrate_club_accounts()
|
||||||
|
migrate_labels()
|
||||||
migrate_journals()
|
migrate_journals()
|
||||||
migrate_operations()
|
migrate_operations()
|
||||||
make_operation_links()
|
make_operation_links()
|
||||||
@ -970,6 +1001,7 @@ def migrate_etickets():
|
|||||||
FROM cpt_etickets
|
FROM cpt_etickets
|
||||||
""")
|
""")
|
||||||
Eticket.objects.all().delete()
|
Eticket.objects.all().delete()
|
||||||
|
print("Etickets deleted")
|
||||||
for r in cur:
|
for r in cur:
|
||||||
try:
|
try:
|
||||||
p = Product.objects.filter(id=r['id_produit']).first()
|
p = Product.objects.filter(id=r['id_produit']).first()
|
||||||
@ -1004,9 +1036,9 @@ def main():
|
|||||||
# migrate_counter()
|
# migrate_counter()
|
||||||
# check_accounts()
|
# check_accounts()
|
||||||
# Accounting
|
# Accounting
|
||||||
# migrate_accounting()
|
migrate_accounting()
|
||||||
# migrate_godfathers()
|
# migrate_godfathers()
|
||||||
migrate_etickets()
|
# migrate_etickets()
|
||||||
# reset_index('core', 'club', 'subscription', 'accounting', 'eboutic', 'launderette', 'counter')
|
# reset_index('core', 'club', 'subscription', 'accounting', 'eboutic', 'launderette', 'counter')
|
||||||
end = datetime.datetime.now()
|
end = datetime.datetime.now()
|
||||||
print("End at %s" % end)
|
print("End at %s" % end)
|
||||||
|
Loading…
Reference in New Issue
Block a user