diff options
| author | Mitch Riedstra <Mitch@riedstra.us> | 2017-11-09 15:57:46 -0500 |
|---|---|---|
| committer | Mitch Riedstra <Mitch@riedstra.us> | 2017-11-09 15:57:46 -0500 |
| commit | 33a6e5cb02189b7621a279c32c12b5c3d83ba680 (patch) | |
| tree | 6d9776af90222f8062921b62fc7f6f4b5fa01dc7 /app/dispatch/models.py | |
| parent | c055260bb88fd407c81ad0d40dd288a5aae4fb17 (diff) | |
| download | dispatch-tracker-33a6e5cb02189b7621a279c32c12b5c3d83ba680.tar.gz dispatch-tracker-33a6e5cb02189b7621a279c32c12b5c3d83ba680.tar.xz | |
Show number of attachments, and color code issues with loads.
Prevent invoice generation on zero amounts and no attachments.
Add a way for superusers to edit invoices.
Add a field to invoices for a payment identifier. E.g. "Check #1234"
Diffstat (limited to 'app/dispatch/models.py')
| -rw-r--r-- | app/dispatch/models.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/dispatch/models.py b/app/dispatch/models.py index fe0cdb3..ef59fe4 100644 --- a/app/dispatch/models.py +++ b/app/dispatch/models.py @@ -40,6 +40,13 @@ class Load(models.Model): def get_absolute_url(self): return "/loads/view/%i" % self.id + def can_invoice(self): + # Prevent 0 and $1 invoices as well as loads w/o attachments + if self.amount >= 2 and len(self.paperwork_set.all()) >= 1: + return True + else: + return False + class Paperwork(models.Model): load = models.ForeignKey(Load, on_delete=models.CASCADE) @@ -96,6 +103,7 @@ class Invoice(models.Model): invoice_date = models.DateField() due_date = models.DateField() paid = models.BooleanField(default=False) + payment_identifer = models.CharField(default="", max_length=256) def __str__(self): return "Invoice for {} by {} for ${}".format( |
