Commit c0e3a9c4 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

Fix merde de 5-1

parent d36995f3
......@@ -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')
......
......@@ -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)
......
# -*- 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,
),
]
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment