diff --git a/cookbook/helper/shopping_helper.py b/cookbook/helper/shopping_helper.py index eaab6a02..c4bcef42 100644 --- a/cookbook/helper/shopping_helper.py +++ b/cookbook/helper/shopping_helper.py @@ -176,7 +176,7 @@ class RecipeShoppingEditor(): if not ingredients: return elif isinstance(ingredients, list): - ingredients = Ingredient.objects.filter(id__in=ingredients) + ingredients = Ingredient.objects.filter(id__in=ingredients, food__ignore_shopping=False) existing = self._shopping_list_recipe.entries.filter(ingredient__in=ingredients).values_list('ingredient__pk', flat=True) add_ingredients = ingredients.exclude(id__in=existing) diff --git a/cookbook/views/api.py b/cookbook/views/api.py index 738abeae..583961a4 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -969,10 +969,11 @@ class RecipeViewSet(viewsets.ModelViewSet): raise PermissionDenied(detail='Not available in demo', code=None) obj = self.get_object() ingredients = request.data.get('ingredients', None) + servings = request.data.get('servings', None) list_recipe = request.data.get('list_recipe', None) mealplan = request.data.get('mealplan', None) - SLR = RecipeShoppingEditor(request.user, request.space, id=list_recipe, recipe=obj, mealplan=mealplan) + SLR = RecipeShoppingEditor(request.user, request.space, id=list_recipe, recipe=obj, mealplan=mealplan, servings=servings) content = {'msg': _(f'{obj.name} was added to the shopping list.')} http_status = status.HTTP_204_NO_CONTENT diff --git a/vue/src/components/Modals/ShoppingModal.vue b/vue/src/components/Modals/ShoppingModal.vue index 47798de1..669d3da6 100644 --- a/vue/src/components/Modals/ShoppingModal.vue +++ b/vue/src/components/Modals/ShoppingModal.vue @@ -1,190 +1,194 @@