Fixs annulations

- Fix oublie de @staticmethod pour Settings.CANCEl_DURATION()
- Mise en cache de Settings.CANCEL_DURATION
- Fix sur cancel_operations : mauvais modèles et at
This commit is contained in:
Aurélien Delobelle 2016-09-03 13:50:40 +02:00
parent d12dfe2f56
commit a432230128
2 changed files with 11 additions and 4 deletions

View file

@ -633,11 +633,17 @@ class Settings(models.Model):
cache.set('OVERDRAFT_AMOUNT', overdraft_amount)
return overdraft_amount
@staticmethod
def CANCEL_DURATION():
cancel_duration = cache.get('CANCEL_DURATION')
if cancel_duration:
return cancel_duration
try:
return Settings.setting_inst("CANCEL_DURATION").value_duration
cancel_duration = Settings.setting_inst("CANCEL_DURATION").value_duration
except Settings.DoesNotExist:
return timedelta()
cancel_duration = timedelta()
cache.set('CANCEL_DURATION', cancel_duration)
return cancel_duration
@staticmethod
def create_missing():
@ -667,6 +673,7 @@ class Settings(models.Model):
def empty_cache():
cache.delete_many([
'SUBVENTION_COF','OVERDRAFT_DURATION', 'OVERDRAFT_AMOUNT',
'CANCEL_DURATION',
])
class GenericTeamToken(models.Model):