mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +00:00
Fix js paiement
This commit is contained in:
parent
00c72ade80
commit
84617e2460
4 changed files with 10 additions and 4 deletions
|
@ -34,6 +34,7 @@ class NewFactureForm(ModelForm):
|
|||
self.fields['cheque'].label = 'Numero de chèque'
|
||||
self.fields['banque'].empty_label = "Non renseigné"
|
||||
self.fields['paiement'].empty_label = "Séléctionner un moyen de paiement"
|
||||
self.fields['paiement'].widget.attrs['data-cheque'] = Paiement.objects.filter(type_paiement=1).first().id
|
||||
|
||||
class Meta:
|
||||
model = Facture
|
||||
|
|
|
@ -172,6 +172,11 @@ class Paiement(models.Model):
|
|||
def clean(self):
|
||||
self.moyen = self.moyen.title()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if Paiement.objects.filter(type_paiement=1).count() > 1:
|
||||
raise ValidationError("On ne peut avoir plusieurs mode de paiement chèque")
|
||||
super(Paiement, self).save(*args, **kwargs)
|
||||
|
||||
class Cotisation(models.Model):
|
||||
PRETTY_NAME = "Cotisations"
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<tr>
|
||||
<td>{{ article.name }}</td>
|
||||
<td>{{ article.prix }}</td>
|
||||
<td>{{ article.cotisation }}</td>
|
||||
<td>{{ article.iscotisation }}</td>
|
||||
<td>{{ article.duration }}</td>
|
||||
<td class="text-right">
|
||||
{% if is_trez %}
|
||||
|
|
|
@ -109,9 +109,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
}
|
||||
|
||||
function set_cheque_info_visibility(){
|
||||
var paiement = document.getElementById("id_paiement");
|
||||
var visible = paiement.value != '' &&
|
||||
paiement.children[paiement.value].dataset['type'] == 'check';
|
||||
var visible = document.getElementById("id_paiement").value == document.getElementById("id_paiement").getAttribute('data-cheque');
|
||||
p = document.getElementById("id_paiement")
|
||||
console.log(p);
|
||||
var display = 'none';
|
||||
if (visible) {
|
||||
display = 'block';
|
||||
|
|
Loading…
Reference in a new issue