Merge pull request #1110 from eeintech/order_save_fix

Fixed saving of purchase and sales order create forms
This commit is contained in:
Oliver 2020-11-06 07:53:41 +11:00 committed by GitHub
commit dadf4d4c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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):
""" """