Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
re2o
Commits
c0e3a9c4
Commit
c0e3a9c4
authored
Jul 22, 2017
by
Gabriel Detraz
Committed by
root
Jul 22, 2017
Browse files
Fix merde de 5-1
parent
d36995f3
Changes
4
Hide whitespace changes
Inline
Side-by-side
cotisations/admin.py
View file @
c0e3a9c4
...
...
@@ -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'
)
...
...
cotisations/forms.py
View file @
c0e3a9c4
...
...
@@ -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
)
...
...
cotisations/migrations/0018_paiement_type_paiement.py
0 → 100644
View file @
c0e3a9c4
# -*- 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
,
),
]
cotisations/models.py
View file @
c0e3a9c4
...
...
@@ -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
.
Ch
oice
Field
(
choices
=
PAYMENT_TYPES
)
type_
paiement
=
models
.
Ch
ar
Field
(
choices
=
PAYMENT_TYPES
,
max_length
=
255
)
def
__str__
(
self
):
return
self
.
moyen
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment