mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1925 from matmair/fix-price-breaksfilters
Fix for missing part filter
This commit is contained in:
commit
90d753001f
@ -15,7 +15,8 @@ from djmoney.contrib.django_rest_framework import MoneyField
|
|||||||
|
|
||||||
from InvenTree.serializers import (InvenTreeAttachmentSerializerField,
|
from InvenTree.serializers import (InvenTreeAttachmentSerializerField,
|
||||||
InvenTreeImageSerializerField,
|
InvenTreeImageSerializerField,
|
||||||
InvenTreeModelSerializer)
|
InvenTreeModelSerializer,
|
||||||
|
InvenTreeMoneySerializer)
|
||||||
from InvenTree.status_codes import BuildStatus, PurchaseOrderStatus
|
from InvenTree.status_codes import BuildStatus, PurchaseOrderStatus
|
||||||
from stock.models import StockItem
|
from stock.models import StockItem
|
||||||
|
|
||||||
@ -102,7 +103,12 @@ class PartSalePriceSerializer(InvenTreeModelSerializer):
|
|||||||
|
|
||||||
quantity = serializers.FloatField()
|
quantity = serializers.FloatField()
|
||||||
|
|
||||||
price = serializers.CharField()
|
price = InvenTreeMoneySerializer(
|
||||||
|
max_digits=19, decimal_places=4,
|
||||||
|
allow_null=True
|
||||||
|
)
|
||||||
|
|
||||||
|
price_string = serializers.CharField(source='price', read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PartSellPriceBreak
|
model = PartSellPriceBreak
|
||||||
@ -111,6 +117,7 @@ class PartSalePriceSerializer(InvenTreeModelSerializer):
|
|||||||
'part',
|
'part',
|
||||||
'quantity',
|
'quantity',
|
||||||
'price',
|
'price',
|
||||||
|
'price_string',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -121,7 +128,12 @@ class PartInternalPriceSerializer(InvenTreeModelSerializer):
|
|||||||
|
|
||||||
quantity = serializers.FloatField()
|
quantity = serializers.FloatField()
|
||||||
|
|
||||||
price = serializers.CharField()
|
price = InvenTreeMoneySerializer(
|
||||||
|
max_digits=19, decimal_places=4,
|
||||||
|
allow_null=True
|
||||||
|
)
|
||||||
|
|
||||||
|
price_string = serializers.CharField(source='price', read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PartInternalPriceBreak
|
model = PartInternalPriceBreak
|
||||||
@ -130,6 +142,7 @@ class PartInternalPriceSerializer(InvenTreeModelSerializer):
|
|||||||
'part',
|
'part',
|
||||||
'quantity',
|
'quantity',
|
||||||
'price',
|
'price',
|
||||||
|
'price_string',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1106,6 +1106,7 @@ function loadPriceBreakTable(table, options) {
|
|||||||
formatNoMatches: function() {
|
formatNoMatches: function() {
|
||||||
return `{% trans "No ${human_name} information found" %}`;
|
return `{% trans "No ${human_name} information found" %}`;
|
||||||
},
|
},
|
||||||
|
queryParams: {part: options.part},
|
||||||
url: options.url,
|
url: options.url,
|
||||||
onLoadSuccess: function(tableData) {
|
onLoadSuccess: function(tableData) {
|
||||||
if (linkedGraph) {
|
if (linkedGraph) {
|
||||||
@ -1114,7 +1115,7 @@ function loadPriceBreakTable(table, options) {
|
|||||||
|
|
||||||
// split up for graph definition
|
// split up for graph definition
|
||||||
var graphLabels = Array.from(tableData, x => x.quantity);
|
var graphLabels = Array.from(tableData, x => x.quantity);
|
||||||
var graphData = Array.from(tableData, x => parseFloat(x.price));
|
var graphData = Array.from(tableData, x => x.price);
|
||||||
|
|
||||||
// destroy chart if exists
|
// destroy chart if exists
|
||||||
if (chart){
|
if (chart){
|
||||||
@ -1201,6 +1202,7 @@ function initPriceBreakSet(table, options) {
|
|||||||
human_name: pb_human_name,
|
human_name: pb_human_name,
|
||||||
url: pb_url,
|
url: pb_url,
|
||||||
linkedGraph: linkedGraph,
|
linkedGraph: linkedGraph,
|
||||||
|
part: part_id,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user