2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-03 13:58:47 +00:00

Merge remote-tracking branch 'inventree/master' into 0.4.x

This commit is contained in:
Oliver 2021-08-09 16:19:47 +10:00
commit 50198c0f1e
3 changed files with 23 additions and 5 deletions

View File

@ -10,11 +10,14 @@ import common.models
INVENTREE_SW_VERSION = "0.4.4"
INVENTREE_API_VERSION = 8
INVENTREE_API_VERSION = 9
"""
Increment this API version number whenever there is a significant change to the API that any clients need to know about
v9 -> 2021-08-09
- Adds "price_string" to part pricing serializers
v8 -> 2021-07-19
- Refactors the API interface for SupplierPart and ManufacturerPart models
- ManufacturerPart objects can no longer be created via the SupplierPart API endpoint

View File

@ -15,7 +15,8 @@ from djmoney.contrib.django_rest_framework import MoneyField
from InvenTree.serializers import (InvenTreeAttachmentSerializerField,
InvenTreeImageSerializerField,
InvenTreeModelSerializer)
InvenTreeModelSerializer,
InvenTreeMoneySerializer)
from InvenTree.status_codes import BuildStatus, PurchaseOrderStatus
from stock.models import StockItem
@ -102,7 +103,12 @@ class PartSalePriceSerializer(InvenTreeModelSerializer):
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:
model = PartSellPriceBreak
@ -111,6 +117,7 @@ class PartSalePriceSerializer(InvenTreeModelSerializer):
'part',
'quantity',
'price',
'price_string',
]
@ -121,7 +128,12 @@ class PartInternalPriceSerializer(InvenTreeModelSerializer):
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:
model = PartInternalPriceBreak
@ -130,6 +142,7 @@ class PartInternalPriceSerializer(InvenTreeModelSerializer):
'part',
'quantity',
'price',
'price_string',
]

View File

@ -1106,6 +1106,7 @@ function loadPriceBreakTable(table, options) {
formatNoMatches: function() {
return `{% trans "No ${human_name} information found" %}`;
},
queryParams: {part: options.part},
url: options.url,
onLoadSuccess: function(tableData) {
if (linkedGraph) {
@ -1114,7 +1115,7 @@ function loadPriceBreakTable(table, options) {
// split up for graph definition
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
if (chart){
@ -1201,6 +1202,7 @@ function initPriceBreakSet(table, options) {
human_name: pb_human_name,
url: pb_url,
linkedGraph: linkedGraph,
part: part_id,
}
);