Skip to content

Order Models Documentation

Overview

The following models are designed to track orders, cancellations, and returns within an e-commerce system. These models ensure a detailed logging and handling of order statuses, cancellations, returns, and associated reasons.


Table: tbl_order_tracking

The OrderTracking model monitors the status of an order throughout its lifecycle.


OrderTracking Model

Column Type Required Description
id AutoField (PK) Yes Primary key for the order tracking record.
order OneToOneField (PurchasedCartItem) Yes References the purchased cart item.
transaction ForeignKey (Transaction) Yes References the payment transaction.
order_status ForeignKey (OrderStatus) Yes References the current status of the order.
has_cancelled BooleanField No Indicates whether the order has been cancelled.
cancelled_at DateField No The date when the order was cancelled.
has_returned BooleanField No Indicates whether the order has been returned.
returned_at DateField No The date when the order was returned.
has_ordered_confirmed BooleanField No Indicates whether the order has been confirmed.
order_confirmed_at DateTimeField No Timestamp when the order was confirmed.
has_shipped BooleanField No Indicates whether the order has been shipped.
shipped_at DateField No The date when the order was shipped.
has_outfor_delivery BooleanField No Indicates whether the order is out for delivery.
outfor_delivery_at DateField No The date when the order was marked out for delivery.
has_delivered BooleanField No Indicates whether the order has been delivered.
delivered_at DateField No The date when the order was delivered.
has_delivery_failed BooleanField No Indicates whether the delivery failed.
delivery_failed_at DateField No The date when the delivery failed.
created_at DateTimeField Yes Timestamp when the tracking record was created.
updated_at DateTimeField Yes Timestamp when the tracking record was last updated.

Meta Information

  • Database Table Name: tbl_order_tracking

String Representation

  • Returns {order_status.status_name}

Additional Properties

  • product: Returns the product associated with the order (order.cart_item.product).

Table: tbl_cancellation_reasons

Column Type Description
id UUID (PK) Primary key for the cancellation reason.
reason String Unique reason for cancellation.
is_active Boolean Indicates whether the reason is active.
created_at DateTime Timestamp when the reason was created.
updated_at DateTime Timestamp when the reason was last updated.

Table: tbl_order_cancellations

Column Type Description
id UUID (PK) Primary key for the order cancellation record.
order_tracking UUID (FK) Foreign key referencing the order tracking record.
reason UUID (FK) Foreign key referencing the cancellation reason.
account_name String Name on the refund account.
account_number String Number of the refund account (validated for minimum length).
bank_name String Name of the refund bank.
bank_branch String Branch of the refund bank.
has_approved Boolean Indicates whether the cancellation has been approved.
refund_processed Boolean Indicates whether the refund has been processed.
refund_amount Decimal Amount refunded to the user.
cancelled_at DateTime Timestamp when the cancellation was made.
updated_at DateTime Timestamp when the record was last updated.

Table: tbl_return_reasons

Column Type Description
id UUID (PK) Primary key for the return reason.
reason String Unique reason for return.
is_active Boolean Indicates whether the reason is active.
created_at DateTime Timestamp when the reason was created.
updated_at DateTime Timestamp when the reason was last updated.

Table: tbl_order_return

Column Type Description
id UUID (PK) Primary key for the order return record.
order_tracking UUID (FK) Foreign key referencing the order tracking record.
reason UUID (FK) Foreign key referencing the return reason.
has_approved Boolean Indicates whether the return has been approved.
account_name String(255) Name of the bank account for refund processing.
account_number String(50) Bank account number for the refund.
bank_name String(255) Name of the bank.
bank_branch String(255) Branch of the bank.
refund_processed Boolean Indicates whether the refund has been processed.
refund_amount Decimal(10,2) The amount refunded to the customer.
returned_at DateTime Timestamp when the return was made.
updated_at DateTime Timestamp when the record was last updated.
rejection_reason Text Reason provided if the return is rejected.
is_rejected Boolean Indicates whether the return request was rejected.