You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.2 KiB
Python
26 lines
1.2 KiB
Python
from django.contrib.auth.models import User
|
|
from django.db import models
|
|
|
|
from accounts.models import DepotUser
|
|
from common.models import CompanyModel
|
|
from containers.models import Container
|
|
|
|
|
|
# Create your models here.
|
|
class Payment(models.Model):
|
|
invoice_number = models.CharField(max_length=50, unique=True)
|
|
total_amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
company = models.ForeignKey(CompanyModel, related_name='payment_company', on_delete=models.CASCADE)
|
|
created_on = models.DateTimeField(auto_now_add=True)
|
|
created_by = models.ForeignKey(DepotUser, related_name='payments_user', on_delete=models.CASCADE)
|
|
paid = models.BooleanField(default=False)
|
|
paid_on = models.DateTimeField(auto_now_add=True)
|
|
paid_info = models.TextField(blank=True, null=True)
|
|
description = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
class PaymentItem(models.Model):
|
|
payment = models.ForeignKey(Payment, related_name='payment_items', on_delete=models.CASCADE)
|
|
container = models.ForeignKey(Container, related_name='payment_containers', on_delete=models.CASCADE)
|
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
|