14 lines
450 B
Python
14 lines
450 B
Python
|
from django.db import models
|
||
|
|
||
|
from .invoice import Invoice
|
||
|
|
||
|
class InvoiceItem(models.Model):
|
||
|
invoice = models.ForeignKey(Invoice, models.CASCADE)
|
||
|
name = models.CharField(max_length=64)
|
||
|
description = models.CharField(max_length=256, null=True, blank=True)
|
||
|
count = models.IntegerField()
|
||
|
net_each = models.DecimalField(max_digits=11, decimal_places=2)
|
||
|
|
||
|
@property
|
||
|
def net_total(self):
|
||
|
return self.net_each * self.count
|