From c29e58aeaa30cd7058a529b24de1e9f163d05406 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 5 May 2023 22:40:20 +1000 Subject: [PATCH] Bug fix for zero quantity pricing (#4766) - Fix default value for formatPriceRange method - Display empty value in table (cherry picked from commit 07d9c2264e2555d55edcc0873ba3de30549bb6fe) --- 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 bef0093417..5ca389704a 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 dcc8d88e59..f05fdd9cec 100644 --- a/InvenTree/templates/js/translated/stock.js +++ b/InvenTree/templates/js/translated/stock.js @@ -2063,6 +2063,10 @@ function loadStockTable(table, options) { currency = baseCurrency(); } + if (row.quantity <= 0) { + return '-'; + } + return formatPriceRange( min_price, max_price,