From 1c3d037baf106da2d3df5ac6ac374dffdce60893 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 5 May 2023 23:08:33 +1000 Subject: [PATCH] Bug fix for zero quantity pricing (#4765) - Fix default value for formatPriceRange method - Display empty value in table --- InvenTree/templates/js/translated/pricing.js | 6 +++++- InvenTree/templates/js/translated/stock.js | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/InvenTree/templates/js/translated/pricing.js b/InvenTree/templates/js/translated/pricing.js index d0af49fef8..61be8796e2 100644 --- a/InvenTree/templates/js/translated/pricing.js +++ b/InvenTree/templates/js/translated/pricing.js @@ -76,7 +76,11 @@ function formatPriceRange(price_min, price_max, options={}) { var p_min = price_min || price_max; var p_max = price_max || price_min; - var quantity = options.quantity || 1; + var quantity = 1; + + if ('quantity' in options) { + quantity = options.quantity; + } if (p_min == null && p_max == null) { return null; diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js index e37375d23a..679539de49 100644 --- a/InvenTree/templates/js/translated/stock.js +++ b/InvenTree/templates/js/translated/stock.js @@ -2072,6 +2072,10 @@ function loadStockTable(table, options) { currency = baseCurrency(); } + if (row.quantity <= 0) { + return '-'; + } + return formatPriceRange( min_price, max_price,