Category |
@@ -147,7 +152,7 @@
$('#activate-part').click(function() {
showQuestionDialog(
'Activate Part?',
- 'Are you sure you wish to reactivate {{ part.long_name }}?',
+ 'Are you sure you wish to reactivate {{ part.full_name }}?',
{
accept_text: 'Activate',
accept: function() {
@@ -169,7 +174,7 @@
$('#deactivate-part').click(function() {
showQuestionDialog(
'Deactivate Part?',
- `Are you sure you wish to deactivate {{ part.long_name }}?
+ `Are you sure you wish to deactivate {{ part.full_name }}?
`,
{
accept_text: 'Deactivate',
@@ -198,16 +203,4 @@
});
});
- $('#stocktake-part').click(function() {
- adjustStock({
- action: 'stocktake',
- query: {
- part: {{ part.id }},
- },
- success: function() {
- location.reload();
- }
- });
- });
-
{% endblock %}
diff --git a/InvenTree/part/templates/part/part_app_base.html b/InvenTree/part/templates/part/part_app_base.html
index ed3ecfb1b9..95c3f26c28 100644
--- a/InvenTree/part/templates/part/part_app_base.html
+++ b/InvenTree/part/templates/part/part_app_base.html
@@ -4,7 +4,7 @@
{% block page_title %}
{% if part %}
-InvenTree | Part - {{ part.long_name }}
+InvenTree | Part - {{ part.full_name }}
{% elif category %}
InvenTree | Part Category - {{ category }}
{% else %}
diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html
index d13495bc52..ea3bbc7617 100644
--- a/InvenTree/part/templates/part/part_base.html
+++ b/InvenTree/part/templates/part/part_base.html
@@ -7,7 +7,7 @@
{% if part.active == False %}
- This part ({{ part.long_name }}) is not active:
+ This part ({{ part.full_name }}) is not active:
{% endif %}
@@ -24,7 +24,7 @@
- {{ part.long_name }}
+ {{ part.full_name }}
{% if part.variant %}
Variant: {{ part.variant }}
diff --git a/InvenTree/part/templates/part/partial_delete.html b/InvenTree/part/templates/part/partial_delete.html
index e30be8444a..6f2509996b 100644
--- a/InvenTree/part/templates/part/partial_delete.html
+++ b/InvenTree/part/templates/part/partial_delete.html
@@ -1,10 +1,10 @@
-Are you sure you want to delete part '{{ part.long_name }}'?
+Are you sure you want to delete part '{{ part.full_name }}'?
{% if part.used_in_count %}
This part is used in BOMs for {{ part.used_in_count }} other parts. If you delete this part, the BOMs for the following parts will be updated:
{% for child in part.used_in.all %}
- - {{ child.part.name }} - {{ child.part.description }}
+ - {{ child.part.full_name }} - {{ child.part.description }}
{% endfor %}
{% endif %}
@@ -30,5 +30,5 @@ Are you sure you want to delete part '{{ part.long_name }}'?
{% endif %}
{% if part.serials.all|length > 0 %}
-There are {{ part.serials.all|length }} unique parts tracked for '{{ part.long_name }}'. Deleting this part will permanently remove this tracking information.
+There are {{ part.serials.all|length }} unique parts tracked for '{{ part.full_name }}'. Deleting this part will permanently remove this tracking information.
{% endif %}
\ No newline at end of file
diff --git a/InvenTree/part/templates/part/supplier.html b/InvenTree/part/templates/part/supplier.html
index 5112dad913..041d1fd8c7 100644
--- a/InvenTree/part/templates/part/supplier.html
+++ b/InvenTree/part/templates/part/supplier.html
@@ -48,7 +48,7 @@
$("#supplier-table").bootstrapTable({
sortable: true,
search: true,
- formatNoMatches: function() { return "No supplier parts available for {{ part.long_name }}"; },
+ formatNoMatches: function() { return "No supplier parts available for {{ part.full_name }}"; },
queryParams: function(p) {
return {
part: {{ part.id }}
diff --git a/InvenTree/part/templates/part/tabs.html b/InvenTree/part/templates/part/tabs.html
index d8e84a6f09..ff2cbbf4a0 100644
--- a/InvenTree/part/templates/part/tabs.html
+++ b/InvenTree/part/templates/part/tabs.html
@@ -12,7 +12,7 @@
{% endif %}
{% if part.buildable %}
-
- BOM{{ part.bom_count }}
+ BOM{{ part.bom_count }}
-
Build{{ part.active_builds|length }}
{% endif %}
diff --git a/InvenTree/part/templates/part/track.html b/InvenTree/part/templates/part/track.html
index 05f9d366d7..9196715437 100644
--- a/InvenTree/part/templates/part/track.html
+++ b/InvenTree/part/templates/part/track.html
@@ -4,7 +4,7 @@
{% include 'part/tabs.html' with tab='track' %}
-Part tracking for {{ part.long_name }}
+Part tracking for {{ part.full_name }}
diff --git a/InvenTree/part/templates/part/used_in.html b/InvenTree/part/templates/part/used_in.html
index f7272dfea6..9210bc446c 100644
--- a/InvenTree/part/templates/part/used_in.html
+++ b/InvenTree/part/templates/part/used_in.html
@@ -27,7 +27,7 @@
$("#used-table").bootstrapTable({
sortable: true,
search: true,
- formatNoMatches: function() { return "{{ part.long_name }} is not used to make any other parts"; },
+ formatNoMatches: function() { return "{{ part.full_name }} is not used to make any other parts"; },
queryParams: function(p) {
return {
sub_part: {{ part.id }}
@@ -43,7 +43,7 @@
field: 'part_detail',
title: 'Part',
formatter: function(value, row, index, field) {
- return imageHoverIcon(row.part_detail.image_url) + renderLink(value.name, value.url + 'bom/');
+ return imageHoverIcon(row.part_detail.image_url) + renderLink(value.full_name, value.url + 'bom/');
}
},
{
diff --git a/InvenTree/part/urls.py b/InvenTree/part/urls.py
index 64b6517489..fb49af8a9b 100644
--- a/InvenTree/part/urls.py
+++ b/InvenTree/part/urls.py
@@ -35,6 +35,7 @@ part_detail_urls = [
url(r'^edit/?', views.PartEdit.as_view(), name='part-edit'),
url(r'^delete/?', views.PartDelete.as_view(), name='part-delete'),
url(r'^bom-export/?', views.BomDownload.as_view(), name='bom-export'),
+ url(r'^validate-bom/', views.BomValidate.as_view(), name='bom-validate'),
url(r'^track/?', views.PartDetail.as_view(template_name='part/track.html'), name='part-track'),
url(r'^attachments/?', views.PartDetail.as_view(template_name='part/attachments.html'), name='part-attachments'),
diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py
index 890cb8a519..135e3da144 100644
--- a/InvenTree/part/views.py
+++ b/InvenTree/part/views.py
@@ -331,12 +331,50 @@ class PartEdit(AjaxUpdateView):
return form
+class BomValidate(AjaxUpdateView):
+ """ Modal form view for validating a part BOM """
+
+ model = Part
+ ajax_form_title = "Validate BOM"
+ ajax_template_name = 'part/bom_validate.html'
+ context_object_name = 'part'
+ form_class = part_forms.BomValidateForm
+
+ def get_context(self):
+ return {
+ 'part': self.get_object(),
+ }
+
+ def get(self, request, *args, **kwargs):
+
+ form = self.get_form()
+
+ return self.renderJsonResponse(request, form, context=self.get_context())
+
+ def post(self, request, *args, **kwargs):
+
+ form = self.get_form()
+ part = self.get_object()
+
+ confirmed = str2bool(request.POST.get('validate', False))
+
+ if confirmed:
+ part.validate_bom(request.user)
+ else:
+ form.errors['validate'] = ['Confirm that the BOM is valid']
+
+ data = {
+ 'form_valid': confirmed
+ }
+
+ return self.renderJsonResponse(request, form, data, context=self.get_context())
+
+
class BomExport(AjaxView):
model = Part
ajax_form_title = 'Export BOM'
ajax_template_name = 'part/bom_export.html'
- context_object_name = 'part'
form_class = part_forms.BomExportForm
def get_object(self):
@@ -345,17 +383,6 @@ class BomExport(AjaxView):
def get(self, request, *args, **kwargs):
form = self.form_class()
- """
- part = self.get_object()
-
- context = {
- 'part': part
- }
-
- if request.is_ajax():
- passs
- """
-
return self.renderJsonResponse(request, form)
def post(self, request, *args, **kwargs):
diff --git a/InvenTree/static/css/inventree.css b/InvenTree/static/css/inventree.css
index 9ce6f52400..7761addc55 100644
--- a/InvenTree/static/css/inventree.css
+++ b/InvenTree/static/css/inventree.css
@@ -14,6 +14,7 @@
color: #ffcc00;
}
+
/* CSS overrides for treeview */
.expand-icon {
font-size: 11px;
@@ -97,6 +98,10 @@
margin-left: 10px;
}
+.badge-alert {
+ background-color: #f33;
+}
+
.part-thumb {
width: 200px;
height: 200px;
@@ -219,6 +224,10 @@
pointer-events: all;
}
+.alert-block {
+ display: block;
+}
+
.btn {
margin-left: 2px;
margin-right: 2px;
diff --git a/InvenTree/static/script/inventree/bom.js b/InvenTree/static/script/inventree/bom.js
index 762c6b1d6b..6e7a33775a 100644
--- a/InvenTree/static/script/inventree/bom.js
+++ b/InvenTree/static/script/inventree/bom.js
@@ -93,7 +93,7 @@ function loadBomTable(table, options) {
title: 'Part',
sortable: true,
formatter: function(value, row, index, field) {
- return imageHoverIcon(value.image_url) + renderLink(value.name, value.url);
+ return imageHoverIcon(value.image_url) + renderLink(value.full_name, value.url);
}
}
);
diff --git a/InvenTree/static/script/inventree/part.js b/InvenTree/static/script/inventree/part.js
index 82757b47bc..c66fe405b2 100644
--- a/InvenTree/static/script/inventree/part.js
+++ b/InvenTree/static/script/inventree/part.js
@@ -123,11 +123,7 @@ function loadPartTable(table, url, options={}) {
title: 'Part',
sortable: true,
formatter: function(value, row, index, field) {
- var name = row.name;
-
- if (row.variant) {
- name = name + " | " + row.variant;
- }
+ var name = row.full_name;
var display = imageHoverIcon(row.image_url) + renderLink(name, row.url);
if (!row.active) {
diff --git a/InvenTree/static/script/inventree/stock.js b/InvenTree/static/script/inventree/stock.js
index ddb20ad1f1..4f32c3f753 100644
--- a/InvenTree/static/script/inventree/stock.js
+++ b/InvenTree/static/script/inventree/stock.js
@@ -393,7 +393,7 @@ function loadStockTable(table, options) {
visible: false,
},
{
- field: 'part.name',
+ field: 'part.full_name',
title: 'Part',
sortable: true,
formatter: function(value, row, index, field) {
diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py
index f24516bfcb..09b9cafff4 100644
--- a/InvenTree/stock/models.py
+++ b/InvenTree/stock/models.py
@@ -180,7 +180,7 @@ class StockItem(models.Model):
reverse('api-stock-detail', kwargs={'pk': self.id}),
{
'part_id': self.part.id,
- 'part_name': self.part.name
+ 'part_name': self.part.full_name
}
)
@@ -464,7 +464,7 @@ class StockItem(models.Model):
def __str__(self):
s = '{n} x {part}'.format(
n=self.quantity,
- part=self.part.name)
+ part=self.part.full_name)
if self.location:
s += ' @ {loc}'.format(loc=self.location.name)
diff --git a/InvenTree/stock/serializers.py b/InvenTree/stock/serializers.py
index fe8462b16c..a0461ff409 100644
--- a/InvenTree/stock/serializers.py
+++ b/InvenTree/stock/serializers.py
@@ -32,7 +32,7 @@ class StockItemSerializerBrief(serializers.ModelSerializer):
""" Brief serializers for a StockItem """
location_name = serializers.CharField(source='location', read_only=True)
- part_name = serializers.CharField(source='part.name', read_only=True)
+ part_name = serializers.CharField(source='part.full_name', read_only=True)
class Meta:
model = StockItem
diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html
index daea4ddf24..8bfe5c8e4e 100644
--- a/InvenTree/stock/templates/stock/item.html
+++ b/InvenTree/stock/templates/stock/item.html
@@ -5,7 +5,7 @@
Stock Item Details
- {{ item.quantity }} × {{ item.part.name }}
+ {{ item.quantity }} × {{ item.part.full_name }}
{% include "qr_button.html" %}
@@ -39,7 +39,7 @@
Part |
- {{ item.part.name }} |
+ {{ item.part.full_name }} |
{% if item.belongs_to %}
diff --git a/InvenTree/stock/templates/stock/item_delete.html b/InvenTree/stock/templates/stock/item_delete.html
index ff22da1d10..9f3f863d75 100644
--- a/InvenTree/stock/templates/stock/item_delete.html
+++ b/InvenTree/stock/templates/stock/item_delete.html
@@ -2,4 +2,4 @@ Are you sure you want to delete this stock item?
-This will remove {{ item.quantity }} units of {{ item.part.name }} from stock.
+This will remove {{ item.quantity }} units of {{ item.part.full_name }} from stock.
diff --git a/InvenTree/stock/templates/stock/location_delete.html b/InvenTree/stock/templates/stock/location_delete.html
index 6c3ee981e5..ecb60ae1f1 100644
--- a/InvenTree/stock/templates/stock/location_delete.html
+++ b/InvenTree/stock/templates/stock/location_delete.html
@@ -30,7 +30,7 @@ If this location is deleted, these items will be moved to the top level 'Stock'
{% for item in location.stock_items.all %}
- - {{ item.part.name }} - {{ item.part.description }}{{ item.quantity }}
+ - {{ item.part.full_name }} - {{ item.part.description }}{{ item.quantity }}
{% endfor %}
{% endif %}
diff --git a/InvenTree/templates/required_part_table.html b/InvenTree/templates/required_part_table.html
index 5d362e8f77..5a8c7e5734 100644
--- a/InvenTree/templates/required_part_table.html
+++ b/InvenTree/templates/required_part_table.html
@@ -8,7 +8,7 @@
{% for part in parts %}
- {{ part.long_name }} |
+ {{ part.full_name }} |
{{ part.description }} |
{{ part.total_stock }} |
{{ part.allocation_count }} |
|