enhance admin pages

This commit is contained in:
Thomas Girod
2022-12-19 20:55:33 +01:00
parent 26c94c9ec6
commit ceb2888f82
12 changed files with 313 additions and 49 deletions

View File

@ -305,6 +305,10 @@ class Product(models.Model):
return True
return False
@property
def profit(self):
return self.selling_price - self.purchase_price
def __str__(self):
return "%s (%s)" % (self.name, self.code)
@ -762,6 +766,12 @@ class Permanency(models.Model):
self.end.strftime("%Y-%m-%d %H:%M:%S") if self.end else "",
)
@property
def duration(self):
if self.end is None:
return self.activity - self.start
return self.end - self.start
class CashRegisterSummary(models.Model):
user = models.ForeignKey(