8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 19:33:11 +00:00

Fix merde de 5-1

This commit is contained in:
Gabriel Detraz 2017-07-22 17:57:58 +02:00 committed by root
parent d36995f30a
commit c0e3a9c4f4
4 changed files with 27 additions and 6 deletions

View file

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

View file

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

View file

@ -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,
),
]

View file

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