models: ignore montant_affecte if it's None (#54050)
It means ligne_banque_pop or facture is None, which will be reported by full_clean().
This commit is contained in:
parent
4d1e40ecab
commit
4089596bff
|
@ -502,7 +502,7 @@ class Payment(models.Model):
|
|||
pass
|
||||
else:
|
||||
deja_affecte = other_payments.aggregate(aggregate).get("montant_affecte") or 0
|
||||
if deja_affecte + self.montant_affecte > self.facture.montant_ttc:
|
||||
if self.montant_affecte is not None and deja_affecte + self.montant_affecte > self.facture.montant_ttc:
|
||||
raise ValidationError(
|
||||
'Le montant affecté aux différentes factures '
|
||||
'est supérieur au montant de l\'encaissement.'
|
||||
|
|
Loading…
Reference in New Issue