mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 21:45:39 +00:00
Rename some fields
- Oops didn't think that through, gotta go through and fix the data now...
This commit is contained in:
@ -129,8 +129,8 @@ class PartList(generics.ListCreateAPIView):
|
||||
filter_fields = [
|
||||
'is_template',
|
||||
'variant_of',
|
||||
'buildable',
|
||||
'consumable',
|
||||
'assembly',
|
||||
'component',
|
||||
'trackable',
|
||||
'purchaseable',
|
||||
'salable',
|
||||
|
@ -57,5 +57,5 @@
|
||||
fields:
|
||||
name: 'Bob'
|
||||
description: 'Can we build it?'
|
||||
buildable: true
|
||||
assembly: true
|
||||
|
@ -101,8 +101,8 @@ class EditPartForm(HelperForm):
|
||||
'default_supplier',
|
||||
'units',
|
||||
'minimum_stock',
|
||||
'buildable',
|
||||
'consumable',
|
||||
'assembly',
|
||||
'component',
|
||||
'trackable',
|
||||
'purchaseable',
|
||||
'salable',
|
||||
|
42
InvenTree/part/migrations/0007_auto_20190602_1944.py
Normal file
42
InvenTree/part/migrations/0007_auto_20190602_1944.py
Normal file
@ -0,0 +1,42 @@
|
||||
# Generated by Django 2.2 on 2019-06-02 09:44
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('part', '0006_auto_20190526_1215'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='part',
|
||||
name='buildable',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='part',
|
||||
name='consumable',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='part',
|
||||
name='assembly',
|
||||
field=models.BooleanField(default=False, help_text='Can this part be built from other parts?', verbose_name='Assembly'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='part',
|
||||
name='component',
|
||||
field=models.BooleanField(default=True, help_text='Can this part be used to build other parts?', verbose_name='Component'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='bomitem',
|
||||
name='part',
|
||||
field=models.ForeignKey(help_text='Select parent part', limit_choices_to={'active': True, 'assembly': True}, on_delete=django.db.models.deletion.CASCADE, related_name='bom_items', to='part.Part'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='bomitem',
|
||||
name='sub_part',
|
||||
field=models.ForeignKey(help_text='Select part to be used in BOM', limit_choices_to={'active': True, 'component': True}, on_delete=django.db.models.deletion.CASCADE, related_name='used_in', to='part.Part'),
|
||||
),
|
||||
]
|
@ -201,8 +201,8 @@ class Part(models.Model):
|
||||
minimum_stock: Minimum preferred quantity to keep in stock
|
||||
units: Units of measure for this part (default='pcs')
|
||||
salable: Can this part be sold to customers?
|
||||
buildable: Can this part be build from other parts?
|
||||
consumable: Can this part be used to make other parts?
|
||||
assembly: Can this part be build from other parts?
|
||||
component: Can this part be used to make other parts?
|
||||
purchaseable: Can this part be purchased from suppliers?
|
||||
trackable: Trackable parts can have unique serial numbers assigned, etc, etc
|
||||
active: Is this part active? Parts are deactivated instead of being deleted
|
||||
@ -343,9 +343,9 @@ class Part(models.Model):
|
||||
|
||||
units = models.CharField(max_length=20, default="pcs", blank=True, help_text='Stock keeping units for this part')
|
||||
|
||||
buildable = models.BooleanField(default=False, help_text='Can this part be built from other parts?')
|
||||
assembly = models.BooleanField(default=False, verbose_name='Assembly', help_text='Can this part be built from other parts?')
|
||||
|
||||
consumable = models.BooleanField(default=True, help_text='Can this part be used to build other parts?')
|
||||
component = models.BooleanField(default=True, verbose_name='Component', help_text='Can this part be used to build other parts?')
|
||||
|
||||
trackable = models.BooleanField(default=False, help_text='Does this part have tracking for unique items?')
|
||||
|
||||
@ -858,7 +858,7 @@ class BomItem(models.Model):
|
||||
part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='bom_items',
|
||||
help_text='Select parent part',
|
||||
limit_choices_to={
|
||||
'buildable': True,
|
||||
'assembly': True,
|
||||
'active': True,
|
||||
})
|
||||
|
||||
@ -867,7 +867,7 @@ class BomItem(models.Model):
|
||||
sub_part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='used_in',
|
||||
help_text='Select part to be used in BOM',
|
||||
limit_choices_to={
|
||||
'consumable': True,
|
||||
'component': True,
|
||||
'active': True
|
||||
})
|
||||
|
||||
|
@ -94,8 +94,8 @@ class PartSerializer(serializers.ModelSerializer):
|
||||
# 'available_stock',
|
||||
'units',
|
||||
'trackable',
|
||||
'buildable',
|
||||
'consumable',
|
||||
'assembly',
|
||||
'component',
|
||||
'trackable',
|
||||
'salable',
|
||||
'active',
|
||||
|
@ -100,13 +100,13 @@
|
||||
</div>
|
||||
<div class='col-sm-6'>
|
||||
<table class='table table-striped'>
|
||||
{% if part.buildable %}
|
||||
{% if part.assembly %}
|
||||
<tr>
|
||||
<td><b>Assembly</b></td>
|
||||
<td><i>This part can be assembled from other parts</i></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if part.consumable %}
|
||||
{% if part.component %}
|
||||
<tr>
|
||||
<td><b>Component</b></td>
|
||||
<td><i>This part can be used in assemblies</i></td>
|
||||
|
@ -78,7 +78,7 @@
|
||||
<td>In Stock</td>
|
||||
<td>{{ part.total_stock }}</td>
|
||||
</tr>
|
||||
{% if part.buildable %}
|
||||
{% if part.assembly %}
|
||||
<tr>
|
||||
<td>Can Build</td>
|
||||
<td>{{ part.can_build }}</td>
|
||||
|
@ -15,13 +15,13 @@
|
||||
<a href="{% url 'part-allocation' part.id %}">Allocated <span class="badge">{{ part.allocation_count }}</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if part.buildable %}
|
||||
{% if part.assembly %}
|
||||
<li{% ifequal tab 'bom' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-bom' part.id %}">BOM<span class="badge{% if part.is_bom_valid == False %} badge-alert{% endif %}">{{ part.bom_count }}</span></a></li>
|
||||
<li{% ifequal tab 'build' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-build' part.id %}">Build<span class='badge'>{{ part.active_builds|length }}</span></a></li>
|
||||
{% endif %}
|
||||
{% if part.consumable or part.used_in_count > 0 %}
|
||||
{% if part.component or part.used_in_count > 0 %}
|
||||
<li{% ifequal tab 'used' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-used-in' part.id %}">Used In{% if part.used_in_count > 0 %}<span class="badge">{{ part.used_in_count }}</span>{% endif %}</a></li>
|
||||
{% endif %}
|
||||
|
@ -149,7 +149,7 @@ class PartAPITest(APITestCase):
|
||||
response = self.client.post(url, data, format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||
|
||||
# Now try to create a BomItem which points to a non-buildable part (should fail)
|
||||
# Now try to create a BomItem which points to a non-assembly part (should fail)
|
||||
data['part'] = 3
|
||||
response = self.client.post(url, data, format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
Reference in New Issue
Block a user