Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove stock for base variant when adding new variants
Marcin Gębala6e7e5fabaa4b
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.pyindex b2f18be379..c4825ec55c 100644--- a/saleor/dashboard/product/forms.py+++ b/saleor/dashboard/product/forms.py@@ -88,6 +88,12 @@ class ProductVariantForm(forms.ModelForm):'product': forms.HiddenInput()}+ def save(self, commit=True):+ if not self.instance.product.has_variants():+ Stock.objects.filter(+ variant=self.instance.product.base_variant).delete()+ super(ProductVariantForm, self).save(commit=commit)+class GenericVariantForm(ProductVariantForm):class Meta: