Add "is_manufacturer" field to company model

This commit is contained in:
Oliver Walters 2020-04-13 09:21:59 +10:00
parent a8ceddc8e4
commit fd45db9e22
3 changed files with 29 additions and 2 deletions

View File

@ -26,8 +26,9 @@ class EditCompanyForm(HelperForm):
'phone', 'phone',
'email', 'email',
'contact', 'contact',
'is_customer',
'is_supplier', 'is_supplier',
'is_manufacturer',
'is_customer',
] ]

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.10 on 2020-04-12 23:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0014_auto_20200407_0116'),
]
operations = [
migrations.AddField(
model_name='company',
name='is_manufacturer',
field=models.BooleanField(default=True, help_text='Does this company manufacture parts?'),
),
]

View File

@ -56,7 +56,12 @@ def rename_company_image(instance, filename):
class Company(models.Model): class Company(models.Model):
""" A Company object represents an external company. """ A Company object represents an external company.
It may be a supplier or a customer (or both). It may be a supplier or a customer or a manufacturer (or a combination)
- A supplier is a company from which parts can be purchased
- A customer is a company to which parts can be sold
- A manufacturer is a company which manufactures a raw good (they may or may not be a "supplier" also)
Attributes: Attributes:
name: Brief name of the company name: Brief name of the company
@ -70,6 +75,7 @@ class Company(models.Model):
notes: Extra notes about the company notes: Extra notes about the company
is_customer: boolean value, is this company a customer is_customer: boolean value, is this company a customer
is_supplier: boolean value, is this company a supplier is_supplier: boolean value, is this company a supplier
is_manufacturer: boolean value, is this company a manufacturer
""" """
name = models.CharField(max_length=100, blank=False, unique=True, name = models.CharField(max_length=100, blank=False, unique=True,
@ -106,6 +112,8 @@ class Company(models.Model):
is_supplier = models.BooleanField(default=True, help_text=_('Do you purchase items from this company?')) is_supplier = models.BooleanField(default=True, help_text=_('Do you purchase items from this company?'))
is_manufacturer = models.BooleanField(default=True, help_text=_('Does this company manufacture parts?'))
def __str__(self): def __str__(self):
""" Get string representation of a Company """ """ Get string representation of a Company """
return "{n} - {d}".format(n=self.name, d=self.description) return "{n} - {d}".format(n=self.name, d=self.description)