Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Disallow changing quantity of items in order line to 0
Marcin Gębalae9385472365c
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.pyindex 9acb74af9f..ecc660d7dd 100644--- a/saleor/dashboard/order/forms.py+++ b/saleor/dashboard/order/forms.py@@ -46,7 +46,9 @@ class MoveItemsForm(forms.Form):def __init__(self, *args, **kwargs):self.item = kwargs.pop('item')super(MoveItemsForm, self).__init__(*args, **kwargs)- self.fields['how_many'].widget.attrs['max'] = self.item.quantity+ self.fields['how_many'].widget.attrs.update({+ 'max': self.item.quantity,+ 'min': 1})self.fields['groups'].choices = self.get_delivery_group_choices()def get_delivery_group_choices(self):@@ -85,7 +87,9 @@ class ChangeQuantityForm(forms.ModelForm):def __init__(self, *args, **kwargs):super(ChangeQuantityForm, self).__init__(*args, **kwargs)self.initial_quantity = self.instance.quantity- self.fields['quantity'].widget.attrs['max'] = self.instance.quantity+ self.fields['quantity'].widget.attrs.update({+ 'max': self.instance.quantity,+ 'min': 1})self.fields['quantity'].initial = self.initial_quantitydef get_variant(self):