mirror of
https://github.com/inventree/InvenTree.git
synced 2026-06-11 19:27:02 +00:00
Bug fix for SalesOrderStatusGroups (#12107)
* Bug fix for SalesOrderStatusGroups - Closes https://github.com/inventree/InvenTree/issues/12087 * Update CHANGELOG * Adjust API unit test * More adjustments
This commit is contained in:
+2
-1
@@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- [#9604](https://github.com/inventree/InvenTree/pull/9604) - refactors user API endpoint to be less ambiguous
|
||||
- [#12107](https://github.com/inventree/InvenTree/pull/12107) makes a breaking change to the `SalesOrderStatusGroups` enum, fixing a bug where the "shipped" status was not included in the "active" group. This change may affect any external client applications which make use of the `SalesOrderStatusGroups` enum, as the "shipped" status will now be included in the "active" group instead of the "complete" group. If you are using this enum in an external client application, you will need to update your application to account for this change.
|
||||
- [#9604](https://github.com/inventree/InvenTree/pull/9604) refactors user API endpoint to be less ambiguous
|
||||
- [#11893](https://github.com/inventree/InvenTree/pull/11893) bumps Node environment to version 24 LTS - this is only relevant if you build the frontend assets yourself
|
||||
|
||||
### Added
|
||||
|
||||
@@ -38,6 +38,14 @@
|
||||
customer: 5
|
||||
status: 60 # Returned
|
||||
|
||||
- model: order.salesorder
|
||||
pk: 6
|
||||
fields:
|
||||
reference: 'ABC128'
|
||||
description: "One sales order, please"
|
||||
customer: 5
|
||||
status: 30 # Complete
|
||||
|
||||
# 1 x R_4K7_0603
|
||||
- model: order.salesorderlineitem
|
||||
pk: 1
|
||||
|
||||
@@ -63,10 +63,11 @@ class SalesOrderStatusGroups:
|
||||
SalesOrderStatus.PENDING.value,
|
||||
SalesOrderStatus.ON_HOLD.value,
|
||||
SalesOrderStatus.IN_PROGRESS.value,
|
||||
SalesOrderStatus.SHIPPED.value,
|
||||
]
|
||||
|
||||
# Completed orders
|
||||
COMPLETE = [SalesOrderStatus.SHIPPED.value, SalesOrderStatus.COMPLETE.value]
|
||||
COMPLETE = [SalesOrderStatus.COMPLETE.value]
|
||||
|
||||
|
||||
class ReturnOrderStatus(StatusCode):
|
||||
|
||||
@@ -1458,19 +1458,21 @@ class SalesOrderTest(OrderTest):
|
||||
def test_so_list(self):
|
||||
"""Test the SalesOrder list API endpoint."""
|
||||
# All orders
|
||||
self.filter({}, 5)
|
||||
self.filter({}, 6)
|
||||
|
||||
# Filter by customer
|
||||
self.filter({'customer': 4}, 3)
|
||||
self.filter({'customer': 5}, 2)
|
||||
self.filter({'customer': 5}, 3)
|
||||
|
||||
# Filter by outstanding
|
||||
self.filter({'outstanding': True}, 3)
|
||||
self.filter({'outstanding': True}, 4)
|
||||
self.filter({'outstanding': False}, 2)
|
||||
|
||||
# Filter by status
|
||||
self.filter({'status': SalesOrderStatus.PENDING.value}, 3) # PENDING
|
||||
self.filter({'status': SalesOrderStatus.SHIPPED.value}, 1) # SHIPPED
|
||||
self.filter({'status': SalesOrderStatus.PENDING.value}, 3)
|
||||
self.filter({'status': SalesOrderStatus.SHIPPED.value}, 1)
|
||||
self.filter({'status': SalesOrderStatus.COMPLETE.value}, 1)
|
||||
self.filter({'status': SalesOrderStatus.CANCELLED.value}, 0)
|
||||
self.filter({'status': 99}, 0) # Invalid
|
||||
|
||||
# Filter by "reference"
|
||||
@@ -1479,7 +1481,7 @@ class SalesOrderTest(OrderTest):
|
||||
|
||||
# Filter by "assigned_to_me"
|
||||
self.filter({'assigned_to_me': 1}, 0)
|
||||
self.filter({'assigned_to_me': 0}, 5)
|
||||
self.filter({'assigned_to_me': 0}, 6)
|
||||
|
||||
def test_total_price(self):
|
||||
"""Unit tests for the 'total_price' field."""
|
||||
@@ -1553,7 +1555,7 @@ class SalesOrderTest(OrderTest):
|
||||
def test_overdue(self):
|
||||
"""Test "overdue" status."""
|
||||
self.filter({'overdue': True}, 0)
|
||||
self.filter({'overdue': False}, 5)
|
||||
self.filter({'overdue': False}, 6)
|
||||
|
||||
for pk in [1, 2]:
|
||||
order = models.SalesOrder.objects.get(pk=pk)
|
||||
@@ -1561,7 +1563,7 @@ class SalesOrderTest(OrderTest):
|
||||
order.save()
|
||||
|
||||
self.filter({'overdue': True}, 2)
|
||||
self.filter({'overdue': False}, 3)
|
||||
self.filter({'overdue': False}, 4)
|
||||
|
||||
def test_so_detail(self):
|
||||
"""Test the SalesOrder detail endpoint."""
|
||||
|
||||
Reference in New Issue
Block a user