Fix unappropriate behavior when delete selling

This commit is contained in:
Skia 2016-11-10 13:51:56 +01:00
parent 11c263b6e7
commit e98ffb5cd5
2 changed files with 6 additions and 6 deletions

View File

@ -55,8 +55,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for i in customer.refillings.order_by('-date').filter( {% for i in customer.refillings.order_by('-date').filter( date__year=year, date__month=month) %}
date__year=year, date__month=month) %}
<tr> <tr>
<td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td> <td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td>
<td>{{ i.counter }}</td> <td>{{ i.counter }}</td>

View File

@ -303,8 +303,9 @@ class Selling(models.Model):
return user == self.customer.user return user == self.customer.user
def delete(self, *args, **kwargs): def delete(self, *args, **kwargs):
self.customer.amount += self.quantity * self.unit_price if self.payment_method == "SITH_ACCOUNT":
self.customer.save() self.customer.amount += self.quantity * self.unit_price
self.customer.save()
super(Selling, self).delete(*args, **kwargs) super(Selling, self).delete(*args, **kwargs)
def send_mail_customer(self): def send_mail_customer(self):