mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1110 from eeintech/order_save_fix
Fixed saving of purchase and sales order create forms
This commit is contained in:
commit
dadf4d4c13
@ -335,7 +335,8 @@ class PurchaseOrderCreate(AjaxCreateView):
|
|||||||
|
|
||||||
order = form.save(commit=False)
|
order = form.save(commit=False)
|
||||||
order.created_by = self.request.user
|
order.created_by = self.request.user
|
||||||
order.save()
|
|
||||||
|
return super().save(form)
|
||||||
|
|
||||||
|
|
||||||
class SalesOrderCreate(AjaxCreateView):
|
class SalesOrderCreate(AjaxCreateView):
|
||||||
@ -370,7 +371,8 @@ class SalesOrderCreate(AjaxCreateView):
|
|||||||
|
|
||||||
order = form.save(commit=False)
|
order = form.save(commit=False)
|
||||||
order.created_by = self.request.user
|
order.created_by = self.request.user
|
||||||
order.save()
|
|
||||||
|
return super().save(form)
|
||||||
|
|
||||||
|
|
||||||
class PurchaseOrderEdit(AjaxUpdateView):
|
class PurchaseOrderEdit(AjaxUpdateView):
|
||||||
@ -428,7 +430,7 @@ class PurchaseOrderCancel(AjaxUpdateView):
|
|||||||
form.add_error('confirm', _('Confirm order cancellation'))
|
form.add_error('confirm', _('Confirm order cancellation'))
|
||||||
|
|
||||||
if not order.can_cancel():
|
if not order.can_cancel():
|
||||||
form.add_error(None, _('Order cannot be cancelled'))
|
form.add_error(None, _('Order cannot be cancelled as either pending or placed'))
|
||||||
|
|
||||||
def save(self, order, form, **kwargs):
|
def save(self, order, form, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user