diff --git a/core/models.py b/core/models.py index 4eb241e3..1b8bafce 100644 --- a/core/models.py +++ b/core/models.py @@ -590,7 +590,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): raise Http404(_(f"{name} does not exist: {product_uuid}")) def remove_product(self, product_uuid: str | None = None, attributes: dict = dict, zero_quantity: bool = False): - if self.status != "PENDING": + if self.status not in ["PENDING", "MOMENTAL"]: raise ValueError(_("you cannot remove products from an order that is not a pending one")) try: product = Product.objects.get(uuid=product_uuid) @@ -614,7 +614,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): raise Http404(_(f"{name} does not exist with query <{query}>")) def remove_all_products(self): - if self.status != "PENDING": + if self.status not in ["PENDING", "MOMENTAL"]: raise ValueError(_("you cannot remove products from an order that is not a pending one")) for order_product in self.order_products.all(): self.order_products.remove(order_product) @@ -622,7 +622,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): return self def remove_products_of_a_kind(self, product_uuid: str): - if self.status != "PENDING": + if self.status not in ["PENDING", "MOMENTAL"]: raise ValueError(_("you cannot remove products from an order that is not a pending one")) try: product = Product.objects.get(uuid=product_uuid)