Browse Source

Fix merde de 5-1

infra2.0
Gabriel Detraz 9 years ago
committed by root
parent
commit
c0e3a9c4f4
  1. 2
      cotisations/admin.py
  2. 6
      cotisations/forms.py
  3. 21
      cotisations/migrations/0018_paiement_type_paiement.py
  4. 4
      cotisations/models.py

2
cotisations/admin.py

@ -38,7 +38,7 @@ class BanqueAdmin(VersionAdmin):
list_display = ('name',)
class PaiementAdmin(VersionAdmin):
list_display = ('moyen',)
list_display = ('moyen','type_paiement')
class CotisationAdmin(VersionAdmin):
list_display = ('vente','date_start','date_end')

6
cotisations/forms.py

@ -46,7 +46,7 @@ class NewFactureForm(ModelForm):
banque = cleaned_data.get("banque")
if not paiement:
raise forms.ValidationError("Le moyen de paiement est obligatoire.")
elif paiement.type_ == "check" and not (cheque and banque):
elif paiement.type_paiement == "check" and not (cheque and banque):
raise forms.ValidationError("Le numéro de chèque et la banque sont obligatoires.")
return cleaned_data
@ -112,12 +112,12 @@ class DelArticleForm(ModelForm):
class PaiementForm(ModelForm):
class Meta:
model = Paiement
fields = ['moyen', 'type_']
fields = ['moyen', 'type_paiement']
def __init__(self, *args, **kwargs):
super(PaiementForm, self).__init__(*args, **kwargs)
self.fields['moyen'].label = 'Moyen de paiement à ajouter'
self.fields['type_'].label = 'Type de paiement à ajouter'
self.fields['type_paiement'].label = 'Type de paiement à ajouter'
class DelPaiementForm(ModelForm):
paiements = forms.ModelMultipleChoiceField(queryset=Paiement.objects.all(), label="Moyens de paiement actuels", widget=forms.CheckboxSelectMultiple)

21
cotisations/migrations/0018_paiement_type_paiement.py

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-22 15:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cotisations', '0017_auto_20170718_2329'),
]
operations = [
migrations.AddField(
model_name='paiement',
name='type_paiement',
field=models.CharField(choices=[('check', 'Chèque'), (None, 'Autre')], default=None, max_length=255),
preserve_default=False,
),
]

4
cotisations/models.py

@ -111,7 +111,7 @@ class Article(models.Model):
help_text="Durée exprimée en mois entiers",
blank=True,
null=True,
min_value=0)
validators=[MinValueValidator(0)])
def clean(self):
if self.name.lower() == "solde":
@ -136,7 +136,7 @@ class Paiement(models.Model):
)
moyen = models.CharField(max_length=255)
type_ = models.ChoiceField(choices=PAYMENT_TYPES)
type_paiement = models.CharField(choices=PAYMENT_TYPES, max_length=255)
def __str__(self):
return self.moyen

Loading…
Cancel
Save