fix accounting model

This commit is contained in:
Robert Einsle 2017-02-04 11:31:48 +01:00
parent 02bb974a92
commit 1a2eb98d20

View File

@ -49,7 +49,7 @@ class Client(models.Model):
desk2_prize_ht = models.DecimalField(max_digits=4, decimal_places=2, blank=True, null=True) desk2_prize_ht = models.DecimalField(max_digits=4, decimal_places=2, blank=True, null=True)
def accounting_for(self, desk_no): def accounting_for(self, desk_no):
return Accounting.objects.filter(location=self.location, client_id=self.id, desk_no=desk_no)[:2][::-1] return Accounting.objects.filter(client_id=self.id, desk_no=desk_no)[:2][::-1]
def accounting_1(self): def accounting_1(self):
return self.accounting_for(1) return self.accounting_for(1)
@ -61,7 +61,7 @@ class Client(models.Model):
return str(self.uuid) return str(self.uuid)
def __unicode__(self): def __unicode__(self):
return str(self.location.name) return str(self.client.location.name)
class Accounting(models.Model): class Accounting(models.Model):
@ -72,10 +72,10 @@ class Accounting(models.Model):
prize = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True) prize = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True)
def __str__(self): def __str__(self):
return self.location.name return self.client.location.name
def __unicode__(self): def __unicode__(self):
return self.location.name return self.client.location.name
class Meta: class Meta:
ordering = ['-time_from'] ordering = ['-time_from']