mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 20:46:47 +00:00
Fix rendering of supplier pack quantity (#6228)
Backport of https://github.com/inventree/InvenTree/pull/6226
This commit is contained in:
parent
e22779872e
commit
4973d9c726
@ -337,6 +337,7 @@ class SupplierPartSerializer(InvenTreeTagModelSerializer):
|
||||
read_only_fields = [
|
||||
'availability_updated',
|
||||
'barcode_hash',
|
||||
'pack_quantity_native',
|
||||
]
|
||||
|
||||
tags = TagListSerializerField(required=False)
|
||||
@ -375,6 +376,8 @@ class SupplierPartSerializer(InvenTreeTagModelSerializer):
|
||||
in_stock = serializers.FloatField(read_only=True)
|
||||
available = serializers.FloatField(required=False)
|
||||
|
||||
pack_quantity_native = serializers.FloatField(read_only=True)
|
||||
|
||||
part_detail = PartBriefSerializer(source='part', many=False, read_only=True)
|
||||
|
||||
supplier_detail = CompanyBriefSerializer(source='supplier', many=False, read_only=True)
|
||||
|
@ -1812,12 +1812,13 @@ function loadPartPurchaseOrderTable(table, part_id, options={}) {
|
||||
formatter: function(value, row) {
|
||||
let data = value;
|
||||
|
||||
if (row.supplier_part_detail.pack_quantity_native != 1.0) {
|
||||
let total = value * row.supplier_part_detail.pack_quantity_native;
|
||||
if (row.supplier_part_detail && row.supplier_part_detail.pack_quantity_native != 1.0) {
|
||||
let pq = row.supplier_part_detail.pack_quantity_native;
|
||||
let total = value * pq;
|
||||
|
||||
data += makeIconBadge(
|
||||
'fa-info-circle icon-blue',
|
||||
`{% trans "Pack Quantity" %}: ${row.pack_quantity} - {% trans "Total Quantity" %}: ${total}`
|
||||
`{% trans "Pack Quantity" %}: ${pq} - {% trans "Total Quantity" %}: ${total}`
|
||||
);
|
||||
}
|
||||
|
||||
@ -1870,9 +1871,10 @@ function loadPartPurchaseOrderTable(table, part_id, options={}) {
|
||||
formatter: function(value, row) {
|
||||
var data = value;
|
||||
|
||||
if (value > 0 && row.supplier_part_detail.pack_quantity_native != 1.0) {
|
||||
let total = value * row.supplier_part_detail.pack_quantity_native;
|
||||
data += `<span class='fas fa-info-circle icon-blue float-right' title='{% trans "Pack Quantity" %}: ${row.pack_quantity} - {% trans "Total Quantity" %}: ${total}'></span>`;
|
||||
if (value > 0 && row.supplier_part_detail && row.supplier_part_detail.pack_quantity_native != 1.0) {
|
||||
let pq = row.supplier_part_detail.pack_quantity_native;
|
||||
let total = value * pq;
|
||||
data += `<span class='fas fa-info-circle icon-blue float-right' title='{% trans "Pack Quantity" %}: ${pq} - {% trans "Total Quantity" %}: ${total}'></span>`;
|
||||
}
|
||||
|
||||
return data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user