Exclude products with hide_on_stock_overview enabled in current stock info on /stockoverview (fixes #2250)

This commit is contained in:
Bernd Bestel 2023-06-08 22:15:33 +02:00
parent de4c6e8b60
commit d05038e311
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 4 additions and 2 deletions

View File

@ -43,6 +43,7 @@
- Fixed that the consumed amount was wrong, when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved - Fixed that the consumed amount was wrong, when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved
- Fixed that for a product's average price, only currently in-stock items were considered, not already consumed ones - Fixed that for a product's average price, only currently in-stock items were considered, not already consumed ones
- Fixed that when copying a product, some fields (like "Default consume location" or "Disable own stock) weren't copied along - Fixed that when copying a product, some fields (like "Default consume location" or "Disable own stock) weren't copied along
- Fixed that the total product count on the stock overview page also included products with "Never show on stock overview" enabled
### Shopping list ### Shopping list

View File

@ -236,7 +236,7 @@ function RefreshStatistics()
{ {
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
{ {
$("#info-current-stock").text(__n(result.length, '%s Product', '%s Products')); $("#info-current-stock").text(__n(result.filter(x => !BoolVal(x.product.hide_on_stock_overview)).length, '%s Product', '%s Products'));
} }
else else
{ {
@ -245,7 +245,8 @@ function RefreshStatistics()
{ {
valueSum += element.value; valueSum += element.value;
}); });
$("#info-current-stock").text(__n(result.length, '%s Product', '%s Products') + ", " + __t('%s total value', valueSum.toLocaleString(undefined, { style: "currency", currency: Grocy.Currency })));
$("#info-current-stock").text(__n(result.filter(x => !BoolVal(x.product.hide_on_stock_overview)).length, '%s Product', '%s Products') + ", " + __t('%s total value', valueSum.toLocaleString(undefined, { style: "currency", currency: Grocy.Currency })));
} }
}, },
function(xhr) function(xhr)