mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 03:49:24 +00:00
core, counter: add preferences for counter notifications
Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
@ -326,11 +326,12 @@ class Refilling(models.Model):
|
||||
self.customer.amount += self.amount
|
||||
self.customer.save()
|
||||
self.is_validated = True
|
||||
Notification(user=self.customer.user, url=reverse('core:user_account_detail',
|
||||
kwargs={'user_id': self.customer.user.id, 'year': self.date.year, 'month': self.date.month}),
|
||||
param=str(self.amount),
|
||||
type="REFILLING",
|
||||
).save()
|
||||
if self.customer.user.preferences.notify_on_refill:
|
||||
Notification(user=self.customer.user, url=reverse('core:user_account_detail',
|
||||
kwargs={'user_id': self.customer.user.id, 'year': self.date.year, 'month': self.date.month}),
|
||||
param=str(self.amount),
|
||||
type="REFILLING",
|
||||
).save()
|
||||
super(Refilling, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
@ -444,13 +445,14 @@ class Selling(models.Model):
|
||||
self.send_mail_customer()
|
||||
except:
|
||||
pass
|
||||
Notification(
|
||||
user=self.customer.user,
|
||||
url=reverse('core:user_account_detail',
|
||||
kwargs={'user_id': self.customer.user.id, 'year': self.date.year, 'month': self.date.month}),
|
||||
param="%d x %s" % (self.quantity, self.label),
|
||||
type="SELLING",
|
||||
).save()
|
||||
if self.customer.user.preferences.notify_on_click:
|
||||
Notification(
|
||||
user=self.customer.user,
|
||||
url=reverse('core:user_account_detail',
|
||||
kwargs={'user_id': self.customer.user.id, 'year': self.date.year, 'month': self.date.month}),
|
||||
param="%d x %s" % (self.quantity, self.label),
|
||||
type="SELLING",
|
||||
).save()
|
||||
super(Selling, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user