Delete old SalesOrderShip view

This commit is contained in:
Oliver 2021-11-30 00:44:42 +11:00
parent 3f9b280e17
commit 6963503d02
4 changed files with 3 additions and 84 deletions

View File

@ -65,17 +65,6 @@ class CancelSalesOrderForm(HelperForm):
] ]
class ShipSalesOrderForm(HelperForm):
confirm = forms.BooleanField(required=True, label=_('Confirm'), help_text=_('Ship order'))
class Meta:
model = SalesOrder
fields = [
'confirm',
]
class AllocateSerialsToSalesOrderForm(forms.Form): class AllocateSerialsToSalesOrderForm(forms.Form):
""" """
Form for assigning stock to a sales order, Form for assigning stock to a sales order,

View File

@ -1,30 +0,0 @@
{% extends "modal_form.html" %}
{% load i18n %}
{% block pre_form_content %}
{% if not order.is_fully_allocated %}
<div class='alert alert-block alert-danger'>
<h4>{% trans "Warning" %}</h4>
{% trans "This order has not been fully allocated. If the order is marked as shipped, it can no longer be adjusted." %}
<br>
{% trans "Ensure that the order allocation is correct before shipping the order." %}
</div>
{% endif %}
{% if order.is_over_allocated %}
<div class='alert alert-block alert-warning'>
{% trans "Some line items in this order have been over-allocated" %}
<br>
{% trans "Ensure that this is correct before shipping the order." %}
</div>
{% endif %}
<div class='alert alert-block alert-info'>
<strong>{% trans "Sales Order" %} {{ order.reference }} - {{ order.customer.name }}</strong>
<br>
{% trans "Shipping this order means that the order will no longer be editable." %}
</div>
{% endblock %}

View File

@ -35,7 +35,6 @@ purchase_order_urls = [
sales_order_detail_urls = [ sales_order_detail_urls = [
url(r'^cancel/', views.SalesOrderCancel.as_view(), name='so-cancel'), url(r'^cancel/', views.SalesOrderCancel.as_view(), name='so-cancel'),
url(r'^ship/', views.SalesOrderShip.as_view(), name='so-ship'),
url(r'^export/', views.SalesOrderExport.as_view(), name='so-export'), url(r'^export/', views.SalesOrderExport.as_view(), name='so-export'),
url(r'^.*$', views.SalesOrderDetail.as_view(), name='so-detail'), url(r'^.*$', views.SalesOrderDetail.as_view(), name='so-detail'),

View File

@ -213,48 +213,6 @@ class PurchaseOrderComplete(AjaxUpdateView):
} }
class SalesOrderShip(AjaxUpdateView):
""" View for 'shipping' a SalesOrder """
form_class = order_forms.ShipSalesOrderForm
model = SalesOrder
context_object_name = 'order'
ajax_template_name = 'order/sales_order_ship.html'
ajax_form_title = _('Ship Order')
def post(self, request, *args, **kwargs):
self.request = request
order = self.get_object()
self.object = order
form = self.get_form()
confirm = str2bool(request.POST.get('confirm', False))
valid = False
if not confirm:
form.add_error('confirm', _('Confirm order shipment'))
else:
valid = True
if valid:
if not order.ship_order(request.user):
form.add_error(None, _('Could not ship order'))
valid = False
data = {
'form_valid': valid,
}
context = self.get_context_data()
context['order'] = order
return self.renderJsonResponse(request, form, data, context)
class PurchaseOrderUpload(FileManagementFormView): class PurchaseOrderUpload(FileManagementFormView):
''' PurchaseOrder: Upload file, match to fields and parts (using multi-Step form) ''' ''' PurchaseOrder: Upload file, match to fields and parts (using multi-Step form) '''
@ -834,6 +792,9 @@ class OrderParts(AjaxView):
order.add_line_item(supplier_part, quantity, purchase_price=purchase_price) order.add_line_item(supplier_part, quantity, purchase_price=purchase_price)
#### TODO: This class MUST be converted to the API forms!
#### TODO: We MUST select the shipment
class SalesOrderAssignSerials(AjaxView, FormMixin): class SalesOrderAssignSerials(AjaxView, FormMixin):
""" """
View for assigning stock items to a sales order, View for assigning stock items to a sales order,