Skip to content

Commit 10ba2a4

Browse files
Renamed procesing status to packed
1 parent 5089013 commit 10ba2a4

File tree

8 files changed

+74
-10
lines changed

8 files changed

+74
-10
lines changed

nxtbn/core/enum_perms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class PermissionsEnum(models.TextChoices):
55
CAN_APPROVE_ORDER = "can_approve_order"
66
CAN_CANCEL_ORDER = "can_cancel_order"
77
CAN_SHIP_ORDER = "can_ship_order"
8-
CAN_PROCCSS_ORDER = "can_process_order"
8+
CAN_PACK_ORDER = "can_pack_order"
99
CAN_DELIVER_ORDER = "can_deliver_order"
1010
CAN_UPDATE_ORDER_PYMENT_TERM = "can_update_order_payment_term"
1111
CAN_UPDATE_ORDER_PAYMENT_METHOD = "can_update_order_payment_method"

nxtbn/order/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class OrderStatus(models.TextChoices):
3232
"""Defines the different stages of an order's lifecycle.
3333
3434
- 'PENDING': Order has been placed but not yet processed.
35-
- 'PROCESSING': Order is being processed and prepared for shipment.
35+
- 'PACKED': Order has been processed and is has packed for shipment.
3636
- 'SHIPPED': Order has been shipped but not yet delivered.
3737
- 'DELIVERED': Order has been delivered to the customer.
3838
- 'CANCELLED': Order has been cancelled and will not be fulfilled.
@@ -41,7 +41,7 @@ class OrderStatus(models.TextChoices):
4141

4242
PENDING = "PENDING", _("Pending")
4343
APPROVED = "APPROVED", _("Approved")
44-
PROCESSING = "PROCESSING", _("Processing")
44+
PACKED = "PACKED", _("Packed")
4545
SHIPPED = "SHIPPED", _("Shipped")
4646
DELIVERED = "DELIVERED", _("Delivered")
4747
CANCELLED = "CANCELLED", _("Cancelled")

nxtbn/order/api/dashboard/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ def validate(self, attrs):
202202
elif current_status not in [OrderStatus.PENDING, OrderStatus.APPROVED]:
203203
raise serializers.ValidationError(_(f"{current_status.value} orders cannot be cancelled."))
204204

205-
if new_status == OrderStatus.PROCESSING:
205+
if new_status == OrderStatus.PACKED:
206206
if current_status != OrderStatus.APPROVED:
207-
raise serializers.ValidationError(_("Only pending orders can be started to processing."))
207+
raise serializers.ValidationError(_("Only pending orders can be started for packing."))
208208

209209
if new_status == OrderStatus.SHIPPED:
210210
if current_status == OrderStatus.CANCELLED:

nxtbn/order/api/dashboard/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def check_permissions(self, request):
436436
OrderStatus.SHIPPED: PermissionsEnum.CAN_SHIP_ORDER,
437437
OrderStatus.DELIVERED: PermissionsEnum.CAN_DELIVER_ORDER,
438438
OrderStatus.APPROVED: PermissionsEnum.CAN_APPROVE_ORDER,
439-
OrderStatus.PROCESSING: PermissionsEnum.CAN_PROCCSS_ORDER,
439+
OrderStatus.PACKED: PermissionsEnum.CAN_PACK_ORDER,
440440
}
441441

442442
required_permission = permission_map.get(status)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Generated by Django 4.2.11 on 2025-02-17 08:00
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("order", "0035_alter_order_options"),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name="order",
15+
name="status",
16+
field=models.CharField(
17+
choices=[
18+
("PENDING", "Pending"),
19+
("APPROVED", "Approved"),
20+
("PACKED", "Packed"),
21+
("SHIPPED", "Shipped"),
22+
("DELIVERED", "Delivered"),
23+
("CANCELLED", "Cancelled"),
24+
("PENDING_RETURN", "Pending Return"),
25+
("RETURNED", "Returned"),
26+
],
27+
default="PENDING",
28+
help_text="Represents the current stage of the order within its lifecycle.",
29+
max_length=20,
30+
verbose_name="Order Status",
31+
),
32+
),
33+
]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Generated by Django 4.2.11 on 2025-02-17 08:07
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("order", "0036_alter_order_status"),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelOptions(
14+
name="order",
15+
options={
16+
"ordering": ("-created_at",),
17+
"permissions": [
18+
("can_approve_order", "Can approve order"),
19+
("can_cancel_order", "Can cancel order"),
20+
("can_ship_order", "Can ship order"),
21+
("can_pack_order", "Can process order"),
22+
("can_deliver_order", "Can deliver order"),
23+
("can_update_order_payment_term", "Can update order payment term"),
24+
(
25+
"can_update_order_payment_method",
26+
"Can update order payment method",
27+
),
28+
],
29+
},
30+
),
31+
]

nxtbn/order/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class Meta:
254254
(PermissionsEnum.CAN_APPROVE_ORDER, 'Can approve order'),
255255
(PermissionsEnum.CAN_CANCEL_ORDER, 'Can cancel order'),
256256
(PermissionsEnum.CAN_SHIP_ORDER, 'Can ship order'),
257-
(PermissionsEnum.CAN_PROCCSS_ORDER, 'Can process order'),
257+
(PermissionsEnum.CAN_PACK_ORDER, 'Can process order'),
258258
(PermissionsEnum.CAN_DELIVER_ORDER, 'Can deliver order'),
259259
(PermissionsEnum.CAN_UPDATE_ORDER_PYMENT_TERM, 'Can update order payment term'),
260260
(PermissionsEnum.CAN_UPDATE_ORDER_PAYMENT_METHOD, 'Can update order payment method'),

nxtbn/order/tests/test_order_reservation_cancel_shipped_merge_return_sc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_order_stock_tracking_with_disallowed_backorder_return(self):
109109
# Now Ship the successfull order
110110
order_status_update_url = reverse('order-status-update', args=[order_less_than_stock_response_with_stock_tracking.data['order_alias']])
111111
approve = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.APPROVED}, format='json')
112-
processing = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.PROCESSING}, format='json')
112+
processing = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.PACKED}, format='json')
113113
approved = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.SHIPPED}, format='json')
114114

115115
self.assertEqual(approve.status_code, status.HTTP_200_OK)
@@ -251,7 +251,7 @@ def test_order_back_order_allowed(self):
251251
# Now Ship the successfull order
252252
order_status_update_url = reverse('order-status-update', args=[order_out_of_stock_response_with_stock_tracking_bo.data['order_alias']])
253253
approve = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.APPROVED}, format='json')
254-
processing = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.PROCESSING}, format='json')
254+
processing = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.PACKED}, format='json')
255255
shipped = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.SHIPPED}, format='json')
256256

257257
self.assertEqual(approve.status_code, status.HTTP_200_OK)
@@ -385,7 +385,7 @@ def test_order_without_tracking_stock(self):
385385
# Now Ship the successfull order
386386
order_status_update_url = reverse('order-status-update', args=[order_response.data['order_alias']])
387387
approve = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.APPROVED}, format='json')
388-
processing = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.PROCESSING}, format='json')
388+
processing = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.PACKED}, format='json')
389389
shipped = self.auth_client.patch(order_status_update_url, {"status": OrderStatus.SHIPPED}, format='json')
390390

391391
self.assertEqual(approve.status_code, status.HTTP_200_OK)

0 commit comments

Comments
 (0)