diff --git a/cookbook/serializer.py b/cookbook/serializer.py
index 59093e9bf..1d39defa4 100644
--- a/cookbook/serializer.py
+++ b/cookbook/serializer.py
@@ -1184,7 +1184,6 @@ class ShoppingListRecipeSerializer(serializers.ModelSerializer):
servings = CustomDecimalField()
def update(self, instance, validated_data):
- # TODO remove once old shopping list
if 'servings' in validated_data and self.context.get('view', None).__class__.__name__ != 'ShoppingListViewSet':
SLR = RecipeShoppingEditor(user=self.context['request'].user, space=self.context['request'].space)
SLR.edit_servings(servings=validated_data['servings'], id=instance.id)
@@ -1274,6 +1273,7 @@ class ShoppingListEntrySimpleCreateSerializer(serializers.Serializer):
amount = CustomDecimalField()
unit_id = serializers.IntegerField(allow_null=True)
food_id = serializers.IntegerField(allow_null=True)
+ ingredient_id = serializers.IntegerField(allow_null=True)
class ShoppingListEntryBulkCreateSerializer(serializers.Serializer):
diff --git a/cookbook/views/api.py b/cookbook/views/api.py
index feadeeceb..6d7257319 100644
--- a/cookbook/views/api.py
+++ b/cookbook/views/api.py
@@ -1375,7 +1375,7 @@ class ShoppingListRecipeViewSet(LoggingMixin, viewsets.ModelViewSet):
pagination_class = DefaultPagination
def get_queryset(self):
- self.queryset = self.queryset.filter(Q(entries__space=self.request.space) | Q(recipe__space=self.request.space))
+ self.queryset = self.queryset.filter(Q(entries__space=self.request.space) | Q(recipe__space=self.request.space) | Q(mealplan__space=self.request.space))
# TODO implement test for this
if not self.detail:
@@ -1405,6 +1405,7 @@ class ShoppingListRecipeViewSet(LoggingMixin, viewsets.ModelViewSet):
amount=e['amount'],
unit_id=e['unit_id'],
food_id=e['food_id'],
+ ingredient_id=e['ingredient_id'],
created_by_id=request.user.id,
space_id=request.space.id,
)
diff --git a/vue3/src/components/dialogs/AddToShoppingDialog.vue b/vue3/src/components/dialogs/AddToShoppingDialog.vue
index 5e5b49e21..3ba336795 100644
--- a/vue3/src/components/dialogs/AddToShoppingDialog.vue
+++ b/vue3/src/components/dialogs/AddToShoppingDialog.vue
@@ -99,6 +99,7 @@ function loadRecipeData() {
amount: ingredient.amount,
food: ingredient.food,
unit: ingredient.unit,
+ ingredient: ingredient,
checked: (ingredient.food ? !(ingredient.food.ignoreShopping || ingredient.food.foodOnhand) : true),
})
})
@@ -132,7 +133,8 @@ function createShoppingListRecipe() {
shoppingListEntries.entries.push({
amount: entry.amount * (servings.value / (recipe.value.servings ? recipe.value.servings : 1)),
foodId: entry.food ? entry.food.id! : null,
- unitId: entry.unit ? entry.unit.id! : null
+ unitId: entry.unit ? entry.unit.id! : null,
+ ingredientId: entry.ingredient ? entry.ingredient.id! : null,
})
}
})
diff --git a/vue3/src/components/dialogs/ModelEditDialog.vue b/vue3/src/components/dialogs/ModelEditDialog.vue
index 72b07d21d..484a470f8 100644
--- a/vue3/src/components/dialogs/ModelEditDialog.vue
+++ b/vue3/src/components/dialogs/ModelEditDialog.vue
@@ -1,6 +1,6 @@
-
+
@@ -20,6 +20,7 @@ const props = defineProps({
model: { type: String as PropType, required: true, },
activator: {default: 'parent'},
item: {default: null},
+ itemId: {type: [Number, String], required: false, default: undefined},
itemDefaults: {required: false},
disabledFields: {default: []},
closeAfterCreate: {default: true},
diff --git a/vue3/src/components/dialogs/ShoppingLineItemDialog.vue b/vue3/src/components/dialogs/ShoppingLineItemDialog.vue
index 93a2392bf..7df931c93 100644
--- a/vue3/src/components/dialogs/ShoppingLineItemDialog.vue
+++ b/vue3/src/components/dialogs/ShoppingLineItemDialog.vue
@@ -50,42 +50,33 @@
-
+
- {{ $n(e.amount) }}
- {{ e.unit.name }}
+ {{ $n(e.amount) }}
+ {{ e.unit.name }}
- {{ e.food.name }}
+
+ {{ e.food.name }}
+
{{ $t('Completed') }} {{ DateTime.fromJSDate(e.completedAt).toLocaleString(DateTime.DATETIME_SHORT) }}
-
- {{ e.recipeMealplan.servings }} x
-
- {{ e.recipeMealplan.recipeName }}
-
+
+ {{ e.listRecipeData.servings }} x {{ e.listRecipeData.recipeData.name }}
-
- {{ e.recipeMealplan.mealplanType }} {{ DateTime.fromJSDate(e.recipeMealplan.mealplanFromDate).toLocaleString(DateTime.DATE_SHORT) }}
+
+ {{ e.listRecipeData.mealPlanData.mealType.name }} {{ DateTime.fromJSDate(e.listRecipeData.mealPlanData.fromDate).toLocaleString(DateTime.DATE_SHORT) }}
{{ e.createdBy.displayName }} - {{ DateTime.fromJSDate(e.createdAt).toLocaleString(DateTime.DATETIME_SHORT) }}
- {{ $t('PostponedUntil') }} {{ DateTime.fromJSDate(e.delayUntil).toLocaleString(DateTime.DATETIME_SHORT) }}
+ {{ $t('PostponedUntil') }} {{ DateTime.fromJSDate(e.delayUntil!).toLocaleString(DateTime.DATETIME_SHORT) }}
-
-
-
-
-
-
-
-
@@ -102,13 +93,15 @@
- (shoppingListFood.entries.set(e.id, args))">
+ { useShoppingStore().entries.set(e.id!, args); shoppingListFood.entries.set(e.id!, args) }">
-
+
-
+
diff --git a/vue3/src/components/display/ShoppingLineItem.vue b/vue3/src/components/display/ShoppingLineItem.vue
index 0da08ed62..bbaefa8f7 100644
--- a/vue3/src/components/display/ShoppingLineItem.vue
+++ b/vue3/src/components/display/ShoppingLineItem.vue
@@ -1,6 +1,6 @@
-
@@ -44,6 +44,7 @@
+