mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1229 from SchrodingersGat/cancel-order-fix
Bug fix for cancelling purchase orders
This commit is contained in:
commit
8d6b4a2fd3
@ -257,7 +257,11 @@ class PurchaseOrder(Order):
|
||||
self.save()
|
||||
|
||||
def can_cancel(self):
|
||||
return self.status not in [
|
||||
"""
|
||||
A PurchaseOrder can only be cancelled under the following circumstances:
|
||||
"""
|
||||
|
||||
return self.status in [
|
||||
PurchaseOrderStatus.PLACED,
|
||||
PurchaseOrderStatus.PENDING
|
||||
]
|
||||
|
@ -47,7 +47,7 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<span class='fas fa-check-circle'></span>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if order.status == PurchaseOrderStatus.PENDING or order.status == PurchaseOrderStatus.PLACED %}
|
||||
{% if order.can_cancel %}
|
||||
<button type='button' class='btn btn-default' id='cancel-order' title='{% trans "Cancel order" %}'>
|
||||
<span class='fas fa-times-circle icon-red'></span>
|
||||
</button>
|
||||
|
@ -432,7 +432,7 @@ class PurchaseOrderCancel(AjaxUpdateView):
|
||||
form.add_error('confirm', _('Confirm order cancellation'))
|
||||
|
||||
if not order.can_cancel():
|
||||
form.add_error(None, _('Order cannot be cancelled as either pending or placed'))
|
||||
form.add_error(None, _('Order cannot be cancelled'))
|
||||
|
||||
def save(self, order, form, **kwargs):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user