mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge remote-tracking branch 'inventree/master'
# Conflicts: # InvenTree/templates/js/model_renderers.js
This commit is contained in:
commit
034c6b9912
@ -747,7 +747,14 @@ class PurchaseOrderLineItem(OrderLineItem):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_base_part(self):
|
def get_base_part(self):
|
||||||
""" Return the base-part for the line item """
|
"""
|
||||||
|
Return the base part.Part object for the line item
|
||||||
|
|
||||||
|
Note: Returns None if the SupplierPart is not set!
|
||||||
|
"""
|
||||||
|
if self.part is None:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
return self.part.part
|
return self.part.part
|
||||||
|
|
||||||
# TODO - Function callback for when the SupplierPart is deleted?
|
# TODO - Function callback for when the SupplierPart is deleted?
|
||||||
|
@ -179,7 +179,11 @@ $("#po-table").inventreeTable({
|
|||||||
field: 'supplier_part_detail.SKU',
|
field: 'supplier_part_detail.SKU',
|
||||||
title: '{% trans "SKU" %}',
|
title: '{% trans "SKU" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
|
if (value) {
|
||||||
return renderLink(value, `/supplier-part/${row.part}/`);
|
return renderLink(value, `/supplier-part/${row.part}/`);
|
||||||
|
} else {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -188,7 +192,7 @@ $("#po-table").inventreeTable({
|
|||||||
field: 'supplier_part_detail.MPN',
|
field: 'supplier_part_detail.MPN',
|
||||||
title: '{% trans "MPN" %}',
|
title: '{% trans "MPN" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
if (row.supplier_part_detail.manufacturer_part) {
|
if (row.supplier_part_detail && row.supplier_part_detail.manufacturer_part) {
|
||||||
return renderLink(value, `/manufacturer-part/${row.supplier_part_detail.manufacturer_part.pk}/`);
|
return renderLink(value, `/manufacturer-part/${row.supplier_part_detail.manufacturer_part.pk}/`);
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
|
@ -181,7 +181,21 @@ function renderPartParameterTemplate(name, data, parameters, options) {
|
|||||||
// Rendered for "SupplierPart" model
|
// Rendered for "SupplierPart" model
|
||||||
function renderSupplierPart(name, data, parameters, options) {
|
function renderSupplierPart(name, data, parameters, options) {
|
||||||
|
|
||||||
var html = select2Thumbnail(data.supplier_detail.image);
|
var supplier_image = null;
|
||||||
|
var part_image = null;
|
||||||
|
|
||||||
|
if (data.supplier_detail) {
|
||||||
|
supplier_image = data.supplier_detail.image;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.part_detail) {
|
||||||
|
part_image = data.part_detail.thumbnail || data.part_detail.image;
|
||||||
|
}
|
||||||
|
|
||||||
|
var html = '';
|
||||||
|
|
||||||
|
html += select2Thumbnail(supplier_image);
|
||||||
|
html += select2Thumbnail(part_image);
|
||||||
|
|
||||||
html += ` <span><b>${data.supplier_detail.name}</b> - ${data.SKU}</span>`;
|
html += ` <span><b>${data.supplier_detail.name}</b> - ${data.SKU}</span>`;
|
||||||
html += ` - <i>${data.part_detail.full_name}</i>`;
|
html += ` - <i>${data.part_detail.full_name}</i>`;
|
||||||
|
@ -696,7 +696,14 @@ function loadStockTable(table, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var link = `/supplier-part/${row.supplier_part}/stock/`;
|
var link = `/supplier-part/${row.supplier_part}/stock/`;
|
||||||
var text = `${row.supplier_part_detail.SKU}`;
|
|
||||||
|
var text = '';
|
||||||
|
|
||||||
|
if (row.supplier_part_detail) {
|
||||||
|
text = `${row.supplier_part_detail.SKU}`;
|
||||||
|
} else {
|
||||||
|
text = `<i>{% trans "Supplier part not specified" %}</i>`;
|
||||||
|
}
|
||||||
|
|
||||||
return renderLink(text, link);
|
return renderLink(text, link);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user