mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Added 'salable' field to Part model
This commit is contained in:
parent
9dc41ba122
commit
45c5edee4d
@ -28,6 +28,7 @@ class EditPartForm(forms.ModelForm):
|
||||
'buildable',
|
||||
'trackable',
|
||||
'purchaseable',
|
||||
'salable',
|
||||
]
|
||||
|
||||
|
||||
|
20
InvenTree/part/migrations/0020_part_salable.py
Normal file
20
InvenTree/part/migrations/0020_part_salable.py
Normal file
@ -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?'),
|
||||
),
|
||||
]
|
@ -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 @@ class Part(models.Model):
|
||||
# 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(
|
||||
|
@ -29,15 +29,19 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Buildable</td>
|
||||
<td>{{ part.buildable }}</td>
|
||||
<td>{% include "yesnolabel.html" with value=part.buildable %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Trackable</td>
|
||||
<td>{{ part.trackable }}</td>
|
||||
<td>{% include "yesnolabel.html" with value=part.trackable %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Purchaseable</td>
|
||||
<td>{{ part.purchaseable }}</td>
|
||||
<td>{% include "yesnolabel.html" with value=part.purchaseable %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Salable</td>
|
||||
<td>{% include "yesnolabel.html" with value=part.salable %}</td>
|
||||
</tr>
|
||||
{% if part.minimum_stock > 0 %}
|
||||
<tr>
|
||||
|
5
InvenTree/part/templates/yesnolabel.html
Normal file
5
InvenTree/part/templates/yesnolabel.html
Normal file
@ -0,0 +1,5 @@
|
||||
{% if value %}
|
||||
<span class='label label-success'>Yes</span>
|
||||
{% else %}
|
||||
<span class='label label-warning'>No</span>
|
||||
{% endif %}
|
Loading…
Reference in New Issue
Block a user