Fixed consume amount validation when consuming a parent product (fixes #1306)

More a workaround for now, the max constraint is just removed when the product has child products,
but the amount to be consumed is checked by StockService anyway, so should not be a problem...
This commit is contained in:
Bernd Bestel
2021-07-11 10:21:36 +02:00
parent 684aef0a42
commit 40e16db01f
3 changed files with 12 additions and 1 deletions

View File

@@ -683,7 +683,8 @@ class StockService extends BaseService
'location' => $location,
'average_shelf_life_days' => $averageShelfLifeDays,
'spoil_rate_percent' => $spoilRate,
'is_aggregated_amount' => $stockCurrentRow->is_aggregated_amount
'is_aggregated_amount' => $stockCurrentRow->is_aggregated_amount,
'has_childs' => $this->getDatabase()->products()->where('parent_product_id = :1', $product->id)->count() !== 0,
];
}