mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Displays "purchase order" column in StockItem table
This commit is contained in:
parent
32385f709b
commit
e6598b5115
@ -75,7 +75,7 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<tr>
|
||||
<td><span class='fas fa-hashtag'></span></td>
|
||||
<td>{% trans "Order Reference" %}</td>
|
||||
<td>{{ order.reference }}{% include "clip.html"%}</td>
|
||||
<td>{% settings_value 'PURCHASEORDER_REFERENCE_PREFIX' %}{{ order.reference }}{% include "clip.html"%}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-info'></span></td>
|
||||
|
@ -77,7 +77,7 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<tr>
|
||||
<td><span class='fas fa-hashtag'></span></td>
|
||||
<td>{% trans "Order Reference" %}</td>
|
||||
<td>{{ order.reference }}{% include "clip.html"%}</td>
|
||||
<td>{% settings_value 'SALESORDER_REFERENCE_PREFIX' %}{{ order.reference }}{% include "clip.html"%}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-info'></span></td>
|
||||
|
@ -81,6 +81,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
||||
'belongs_to',
|
||||
'build',
|
||||
'customer',
|
||||
'purchase_order',
|
||||
'sales_order',
|
||||
'supplier_part',
|
||||
'supplier_part__supplier',
|
||||
@ -163,6 +164,10 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
||||
|
||||
purchase_price = serializers.SerializerMethodField()
|
||||
|
||||
purchase_order_reference = serializers.CharField(source='purchase_order.reference', read_only=True)
|
||||
|
||||
sales_order_reference = serializers.CharField(source='sales_order.reference', read_only=True)
|
||||
|
||||
def get_purchase_price(self, obj):
|
||||
""" Return purchase_price (Money field) as string (includes currency) """
|
||||
|
||||
@ -208,10 +213,13 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
||||
'packaging',
|
||||
'part',
|
||||
'part_detail',
|
||||
'purchase_order',
|
||||
'purchase_order_reference',
|
||||
'pk',
|
||||
'quantity',
|
||||
'required_tests',
|
||||
'sales_order',
|
||||
'sales_order_reference',
|
||||
'serial',
|
||||
'stale',
|
||||
'status',
|
||||
|
@ -660,6 +660,27 @@ function loadStockTable(table, options) {
|
||||
title: '{% trans "Last Updated" %}',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
field: 'purchase_order',
|
||||
title: '{% trans "Purchase Order" %}',
|
||||
formatter: function(value, row) {
|
||||
if (!value) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
var link = `/order/purchase-order/${row.purchase_order}/`;
|
||||
var text = `${row.purchase_order}`;
|
||||
|
||||
if (row.purchase_order_reference) {
|
||||
|
||||
var prefix = '{% settings_value "PURCHASEORDER_REFERENCE_PREFIX" %}';
|
||||
|
||||
text = prefix + row.purchase_order_reference;
|
||||
}
|
||||
|
||||
return renderLink(text, link);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'purchase_price',
|
||||
title: '{% trans "Purchase Price" %}',
|
||||
|
Loading…
Reference in New Issue
Block a user