Fix linting

This commit is contained in:
Yohann D'ANELLO 2020-09-14 09:09:20 +02:00
parent dbc6fbbf71
commit 5ed0560953
4 changed files with 15 additions and 17 deletions

View File

@ -5,7 +5,7 @@ import unicodedata
from django.conf import settings
from django.conf.global_settings import DEFAULT_FROM_EMAIL
from django.core.exceptions import ValidationError, PermissionDenied
from django.core.exceptions import ValidationError
from django.core.mail import send_mail
from django.core.validators import RegexValidator
from django.db import models, transaction

View File

@ -3,7 +3,6 @@
from django.core.exceptions import ValidationError
from django.db import models, transaction
from django.db.models import F
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import gettext_lazy as _

View File

@ -4,7 +4,6 @@
from functools import lru_cache
from time import time
from django.conf import settings
from django.contrib.sessions.models import Session
from note_kfet.middlewares import get_current_session

View File

@ -307,10 +307,10 @@ class SogeCredit(models.Model):
if self.valid:
self.credit_transaction.valid = False
self.credit_transaction.save()
for transaction in self.transactions.all():
transaction.valid = False
transaction._force_save = True
transaction.save()
for tr in self.transactions.all():
tr.valid = False
tr._force_save = True
tr.save()
def validate(self, force=False):
if self.valid and not force:
@ -325,11 +325,11 @@ class SogeCredit(models.Model):
self.credit_transaction.save()
self.save()
for transaction in self.transactions.all():
transaction.valid = True
transaction._force_save = True
transaction.created_at = timezone.now()
transaction.save()
for tr in self.transactions.all():
tr.valid = True
tr._force_save = True
tr.created_at = timezone.now()
tr.save()
@transaction.atomic
def save(self, *args, **kwargs):
@ -364,11 +364,11 @@ class SogeCredit(models.Model):
"Please ask her/him to credit the note before invalidating this credit."))
self.invalidate()
for transaction in self.transactions.all():
transaction._force_save = True
transaction.valid = True
transaction.created_at = timezone.now()
transaction.save()
for tr in self.transactions.all():
tr._force_save = True
tr.valid = True
tr.created_at = timezone.now()
tr.save()
self.credit_transaction.valid = False
self.credit_transaction.reason += " (invalide)"
self.credit_transaction.save()