From 906ed7f64d335767470e0183dbc571e806d4461c Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 13 Apr 2020 09:21:59 +1000 Subject: [PATCH] Add "is_manufacturer" field to company model (cherry picked from commit fd45db9e2231398144e04efbb6c17705f73ad826) --- InvenTree/company/forms.py | 3 ++- .../migrations/0015_company_is_manufacturer.py | 18 ++++++++++++++++++ InvenTree/company/models.py | 10 +++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 InvenTree/company/migrations/0015_company_is_manufacturer.py diff --git a/InvenTree/company/forms.py b/InvenTree/company/forms.py index 85424eb3a1..0da509a3b5 100644 --- a/InvenTree/company/forms.py +++ b/InvenTree/company/forms.py @@ -26,8 +26,9 @@ class EditCompanyForm(HelperForm): 'phone', 'email', 'contact', - 'is_customer', 'is_supplier', + 'is_manufacturer', + 'is_customer', ] diff --git a/InvenTree/company/migrations/0015_company_is_manufacturer.py b/InvenTree/company/migrations/0015_company_is_manufacturer.py new file mode 100644 index 0000000000..bf7d23ebe9 --- /dev/null +++ b/InvenTree/company/migrations/0015_company_is_manufacturer.py @@ -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?'), + ), + ] diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py index 462b4ff847..f1610e5687 100644 --- a/InvenTree/company/models.py +++ b/InvenTree/company/models.py @@ -56,7 +56,12 @@ def rename_company_image(instance, filename): class Company(models.Model): """ 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: name: Brief name of the company @@ -70,6 +75,7 @@ class Company(models.Model): notes: Extra notes about the company is_customer: boolean value, is this company a customer 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, @@ -106,6 +112,8 @@ class Company(models.Model): 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): """ Get string representation of a Company """ return "{n} - {d}".format(n=self.name, d=self.description)