mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Don't allow tare weight handling enabled products to be opened (closes #770)
This commit is contained in:
parent
62c9c285ba
commit
28276191cc
@ -60,6 +60,7 @@ _- (Because the stock quantity unit is now the base for everything, it cannot be
|
|||||||
- Fixed that `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING` is set to `false`, the purchase page validation failed (thanks @fipwmaqzufheoxq92ebc)
|
- Fixed that `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING` is set to `false`, the purchase page validation failed (thanks @fipwmaqzufheoxq92ebc)
|
||||||
- Fixed that consuming products with enabled tare weight handling did not work on the stock entries page (also fixed that opening those products is not possible there)
|
- Fixed that consuming products with enabled tare weight handling did not work on the stock entries page (also fixed that opening those products is not possible there)
|
||||||
- Fixed that the recipes dropdown on the consume page also displayed internal recipes (thanks @kriddles)
|
- Fixed that the recipes dropdown on the consume page also displayed internal recipes (thanks @kriddles)
|
||||||
|
- Fixed that opening tare weight handling enabled products is not possible via the UI and the API (as this makes no sense)
|
||||||
|
|
||||||
### Shopping list improvements
|
### Shopping list improvements
|
||||||
- Decimal amounts are now allowed (for any product, rounded by two decimal places)
|
- Decimal amounts are now allowed (for any product, rounded by two decimal places)
|
||||||
|
@ -372,7 +372,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
$('#display_amount').focus();
|
$('#display_amount').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (productDetails.stock_amount == productDetails.stock_amount_opened)
|
if (productDetails.stock_amount == productDetails.stock_amount_opened || productDetails.product.enable_tare_weight_handling == 1)
|
||||||
{
|
{
|
||||||
$("#save-mark-as-open-button").addClass("disabled");
|
$("#save-mark-as-open-button").addClass("disabled");
|
||||||
}
|
}
|
||||||
|
@ -740,6 +740,11 @@ class StockService extends BaseService
|
|||||||
$potentialStockEntries = $this->GetProductStockEntries($productId, true);
|
$potentialStockEntries = $this->GetProductStockEntries($productId, true);
|
||||||
$product = $this->getDatabase()->products($productId);
|
$product = $this->getDatabase()->products($productId);
|
||||||
|
|
||||||
|
if ($product->enable_tare_weight_handling == 1)
|
||||||
|
{
|
||||||
|
throw new \Exception('Opening tare weight handling enabled products is not supported');
|
||||||
|
}
|
||||||
|
|
||||||
if ($amount > $productStockAmountUnopened)
|
if ($amount > $productStockAmountUnopened)
|
||||||
{
|
{
|
||||||
throw new \Exception('Amount to be opened cannot be > current unopened stock amount');
|
throw new \Exception('Amount to be opened cannot be > current unopened stock amount');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user