mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Renderer for supplier part
This commit is contained in:
parent
52952a8a8b
commit
72526307ae
@ -179,9 +179,10 @@ class SupplierPartSerializer(InvenTreeModelSerializer):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
||||||
part_detail = kwargs.pop('part_detail', False)
|
part_detail = kwargs.pop('part_detail', True)
|
||||||
supplier_detail = kwargs.pop('supplier_detail', False)
|
supplier_detail = kwargs.pop('supplier_detail', True)
|
||||||
manufacturer_detail = kwargs.pop('manufacturer_detail', False)
|
manufacturer_detail = kwargs.pop('manufacturer_detail', True)
|
||||||
|
|
||||||
prettify = kwargs.pop('pretty', False)
|
prettify = kwargs.pop('pretty', False)
|
||||||
|
|
||||||
super(SupplierPartSerializer, self).__init__(*args, **kwargs)
|
super(SupplierPartSerializer, self).__init__(*args, **kwargs)
|
||||||
|
@ -336,9 +336,10 @@ class PartSerializer(InvenTreeModelSerializer):
|
|||||||
'category',
|
'category',
|
||||||
'category_detail',
|
'category_detail',
|
||||||
'component',
|
'component',
|
||||||
'description',
|
|
||||||
'default_location',
|
|
||||||
'default_expiry',
|
'default_expiry',
|
||||||
|
'default_location',
|
||||||
|
'default_supplier',
|
||||||
|
'description',
|
||||||
'full_name',
|
'full_name',
|
||||||
'image',
|
'image',
|
||||||
'in_stock',
|
'in_stock',
|
||||||
|
@ -1128,6 +1128,9 @@ function renderModelData(name, model, data, parameters, options) {
|
|||||||
case 'partcategory':
|
case 'partcategory':
|
||||||
renderer = renderPartCategory;
|
renderer = renderPartCategory;
|
||||||
break;
|
break;
|
||||||
|
case 'supplierpart':
|
||||||
|
renderer = renderSupplierPart;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -109,4 +109,24 @@ function renderPartCategory(name, data, parameters, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Rendered for "SupplierPart" model
|
||||||
|
function renderSupplierPart(name, data, parameters, options) {
|
||||||
|
|
||||||
|
var image = data.supplier_detail.image;
|
||||||
|
|
||||||
|
if (!image) {
|
||||||
|
image = `/static/img/blank_image.png`;
|
||||||
|
}
|
||||||
|
|
||||||
|
var html = `<img src='${image}' class='select2-thumbnail'>`;
|
||||||
|
|
||||||
|
html += ` <span><b>${data.supplier_detail.name}</b> - ${data.SKU}</span>`;
|
||||||
|
|
||||||
|
html += `<span class='float-right'>{% trans "Supplier Part ID" %}: ${data.pk}</span>`;
|
||||||
|
|
||||||
|
return html;
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user