mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-11-04 11:03:04 +00:00 
			
		
		
		
	Fix unappropriate behavior when delete selling
This commit is contained in:
		@@ -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>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -303,6 +303,7 @@ class Selling(models.Model):
 | 
				
			|||||||
        return user == self.customer.user
 | 
					        return user == self.customer.user
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def delete(self, *args, **kwargs):
 | 
					    def delete(self, *args, **kwargs):
 | 
				
			||||||
 | 
					        if self.payment_method == "SITH_ACCOUNT":
 | 
				
			||||||
            self.customer.amount += self.quantity * self.unit_price
 | 
					            self.customer.amount += self.quantity * self.unit_price
 | 
				
			||||||
            self.customer.save()
 | 
					            self.customer.save()
 | 
				
			||||||
        super(Selling, self).delete(*args, **kwargs)
 | 
					        super(Selling, self).delete(*args, **kwargs)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user