Here are the models
class Profile(models.Model):
user = models.OneToOneField(User, null=True, on_delete=models.CASCADE)
name = models.CharField(max_length=200, null=True)
phone = models.CharField(max_length=200, blank=True, null=True)
email = models.CharField(max_length=200, blank=True, null=True)
date_created = models.DateTimeField(auto_now_add=True, null=True)
group = models.ManyToManyField(UserGroup)
def __str__(self):
return self.user.username
class UserGroup(models.Model):
name = models.CharField('Name', max_length=100, null = True)
def __str__(self):
return self.name
class WorkorderItem(models.Model):
workorder = models.ForeignKey(Workorder, blank=False, null=True, on_delete=models.SET_NULL)
workorder_hr = models.CharField('Workorder Human Readable', max_length=100, blank=False, null=False)
item_category = models.ForeignKey(Category, blank=True, null=True, on_delete=models.SET_NULL)
item_subcategory = models.ForeignKey(SubCategory, blank=True, null=True, on_delete=models.SET_NULL)
setprice_category = models.ForeignKey(SetPriceItem, blank=True, null=True, on_delete=models.SET_NULL)
setprice_item = models.ForeignKey(SetPriceItemPrice, blank=True, null=True, on_delete=models.SET_NULL)
#item_subcategory = models.CharField('Subcategory', max_length=100, blank=True, null=True)
pricesheet_modified = models.BooleanField('Pricesheet Modified', blank=True, null=True, default=False)
design_type = models.ForeignKey(DesignType, blank=True, null=True, on_delete=models.SET_NULL)
postage_type = models.ForeignKey(PostageType, blank=True, null=True, on_delete=models.SET_NULL)
description = models.CharField('Description', max_length=100, blank=False, null=False)
item_order = models.PositiveSmallIntegerField('Display Order', blank=True, null=True)
quantity = models.DecimalField('Quantity', max_digits=6, decimal_places=2, blank=True, null=True)
unit_price = models.DecimalField('Unit Price', max_digits=10, decimal_places=4, blank=True, null=True)
total_price = models.DecimalField('Total Price', max_digits=8, decimal_places=2, blank=True, null=True)
override_price = models.DecimalField('Override Price', max_digits=8, decimal_places=2, blank=True, null=True)
absolute_price = models.DecimalField('Absolute Price', max_digits=8, decimal_places=2, blank=True, null=True)
last_item_order = models.CharField('Original Item Order', max_length=100, blank=True, null=True)
last_item_price = models.CharField('Original Item Price', max_length=100, blank=True, null=True)
billable = models.BooleanField(default=True)
notes = models.TextField('Notes:', blank=True, null=False)
show_notes = models.BooleanField(default=False)
internal_company = models.CharField('Internal Company', choices=[('LK Design', 'LK Design'), ('Krueger Printing', 'Krueger Printing')], max_length=100, blank=False, null=False)
tax_exempt = models.BooleanField(default=False)
tax_amount = models.DecimalField('Tax Amount', max_digits=8, decimal_places=2, blank=True, null=True)
total_with_tax = models.DecimalField('Total', max_digits=8, decimal_places=2, blank=True, null=True)
parent_item = models.PositiveSmallIntegerField('Parent Item', blank=True, null=True)
added_to_parent = models.BooleanField(blank=False, null=False, default=False)
parent = models.BooleanField(blank=False, null=False, default=False)
child = models.BooleanField(blank=False, null=False, default=False)
job_status = models.ForeignKey(JobStatus, blank=True, null=True, on_delete=models.SET_NULL)
completed = models.BooleanField(blank=False, null=False, default=False)
assigned_user = models.ForeignKey(User, blank=True, null=True, on_delete=models.SET_NULL)
test_user = models.ForeignKey(Profile, blank=True, null=True, on_delete=models.SET_NULL)
assigned_group = models.ForeignKey(UserGroup, blank=True, null=True, on_delete=models.SET_NULL)
created = models.DateTimeField(auto_now_add=True, blank=False, null=False)
updated = models.DateTimeField(auto_now = True, blank=False, null=False)
def __str__(self):
return self.workorder.workorder