diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index f986e1a0ae14..1b35767a31aa 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -28,6 +28,7 @@ class Meta: 'buildable', 'trackable', 'purchaseable', + 'salable', ] diff --git a/InvenTree/part/migrations/0020_part_salable.py b/InvenTree/part/migrations/0020_part_salable.py new file mode 100644 index 000000000000..9d2453227331 --- /dev/null +++ b/InvenTree/part/migrations/0020_part_salable.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.12 on 2018-04-17 08:06 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0019_auto_20180416_1249'), + ] + + operations = [ + migrations.AddField( + model_name='part', + name='salable', + field=models.BooleanField(default=False, help_text='Can this part be sold to customers?'), + ), + ] diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 3d2fe90628b3..16c349cf1128 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -1,15 +1,18 @@ +# -*- coding: utf-8 -*- from __future__ import unicode_literals + +import os + from django.db import models from django.db.models import Sum from django.core.validators import MinValueValidator -from InvenTree.models import InvenTreeTree - -import os - from django.db.models.signals import pre_delete from django.dispatch import receiver +from InvenTree.models import InvenTreeTree +# from stock.models import StockLocation + class PartCategory(InvenTreeTree): """ PartCategory provides hierarchical organization of Part objects. @@ -121,6 +124,9 @@ def get_absolute_url(self): # Is this part "purchaseable"? purchaseable = models.BooleanField(default=True, help_text='Can this part be purchased from external suppliers?') + # Can this part be sold to customers? + salable = models.BooleanField(default=False, help_text="Can this part be sold to customers?") + def __str__(self): if self.IPN: return "{name} ({ipn})".format( diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 1059b65f0435..0e1c7aae34b7 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -29,15 +29,19 @@

Part Details

Buildable - {{ part.buildable }} + {% include "yesnolabel.html" with value=part.buildable %} Trackable - {{ part.trackable }} + {% include "yesnolabel.html" with value=part.trackable %} Purchaseable - {{ part.purchaseable }} + {% include "yesnolabel.html" with value=part.purchaseable %} + + + Salable + {% include "yesnolabel.html" with value=part.salable %} {% if part.minimum_stock > 0 %} diff --git a/InvenTree/part/templates/yesnolabel.html b/InvenTree/part/templates/yesnolabel.html new file mode 100644 index 000000000000..cdc607056040 --- /dev/null +++ b/InvenTree/part/templates/yesnolabel.html @@ -0,0 +1,5 @@ +{% if value %} +Yes +{% else %} +No +{% endif %} \ No newline at end of file