Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Better, non-conflicting form field name
Marcin Gębala60509ba8a2c6
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.pyindex d623e7de6c..ff8c59ce87 100644--- a/saleor/dashboard/order/forms.py+++ b/saleor/dashboard/order/forms.py@@ -38,7 +38,7 @@ class ManagePaymentForm(forms.Form):class MoveItemsForm(forms.ModelForm):- quantity = QuantityField()+ how_many = QuantityField()groups = forms.ChoiceField()class Meta:@@ -47,7 +47,7 @@ class MoveItemsForm(forms.ModelForm):def __init__(self, *args, **kwargs):super(MoveItemsForm, self).__init__(*args, **kwargs)- self.fields['quantity'].widget.attrs['max'] = self.instance.quantity+ self.fields['how_many'].widget.attrs['max'] = self.instance.quantityself.fields['groups'].choices = self.get_delivery_group_choices()def get_delivery_group_choices(self):@@ -59,17 +59,17 @@ class MoveItemsForm(forms.ModelForm):return choicesdef save(self, user=None):- quantity = self.cleaned_data['quantity']+ how_many = self.cleaned_data['how_many']choice = self.cleaned_data['groups']if choice == 'new':target_group = DeliveryGroup.objects.duplicate_group(self.instance.delivery_group.pk)else:target_group = DeliveryGroup.objects.get(pk=choice)- OrderedItem.objects.move_to_group(self.instance, target_group, quantity)- comment = _('Moved %(quantity)s items %(item)s from group '+ OrderedItem.objects.move_to_group(self.instance, target_group, how_many)+ comment = _('Moved %(how_many)s items %(item)s from group ''#%(old_group)s to group #%(new_group)s' % {- 'quantity': quantity, 'item': self.instance,+ 'how_many': how_many, 'item': self.instance,'old_group': self.instance.delivery_group.pk,'new_group': target_group.pk})order = self.instance.delivery_group.orderdiff --git a/saleor/dashboard/templates/dashboard/includes/modal_order_line_edit.html b/saleor/dashboard/templates/dashboard/includes/modal_order_line_edit.htmlindex b66b003c91..5a4eda8127 100644--- a/saleor/dashboard/templates/dashboard/includes/modal_order_line_edit.html+++ b/saleor/dashboard/templates/dashboard/includes/modal_order_line_edit.html@@ -18,7 +18,7 @@<form class="form-inline" method="post" role="form" action={% url 'dashboard:order-line-edit' pk=object.pk %}?action=move_items_form>{% csrf_token %}<div class="form-group">- <span>Move {% render_widget move_items_form.quantity class="form-control input-sm" %} items to delivery group: {% render_widget move_items_form.groups class="form-control input-sm" %}+ <span>Move {% render_widget move_items_form.how_many class="form-control input-sm" %} items to delivery group: {% render_widget move_items_form.groups class="form-control input-sm" %}<button type="submit" class="btn btn-default btn-sm">OK</button></span></div></form>