Change SalesOrder.can_cancel() (#4544)

* Change SalesOrder.can_cancel()

* fix
This commit is contained in:
Oliver 2023-03-31 10:59:28 +11:00 committed by GitHub
parent 08d0084e07
commit d0f9d0d830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -868,14 +868,11 @@ class SalesOrder(TotalPriceMixin, Order):
def can_cancel(self):
"""Return True if this order can be cancelled."""
if self.status != SalesOrderStatus.PENDING:
return False
return True
return self.is_open
@transaction.atomic
def cancel_order(self):
"""Cancel this order (only if it is "pending").
"""Cancel this order (only if it is "open").
Executes:
- Mark the order as 'cancelled'