1
0
forked from erp-dev/erp

fix: exclude ran out state_id for api_v2.get_plate_orders_bet_by_state_status

This commit is contained in:
2025-12-25 19:11:06 +08:00
parent 6f6bcee761
commit 0ddf63f3c0
3 changed files with 32 additions and 2 deletions

View File

@@ -1165,6 +1165,21 @@ class PlateOrderByStateStatusV2APITest(TestCase):
ids = [item['id'] for item in resp.data['results']]
self.assertNotIn(self.po_other_process.id, ids)
def test_completed_status_only_returns_latest_state(self):
resp = self.client.get(
self.url,
{
'process_id': self.process.id,
'state_id': self.state_prepare.id,
'status': 'completed',
}
)
self.assertEqual(resp.status_code, 200)
ids = [item['id'] for item in resp.data['results']]
self.assertEqual(set(ids), {self.po_not_started.id, self.po_cancelled.id})
self.assertNotIn(self.po_completed_old.id, ids)
self.assertNotIn(self.po_completed_new.id, ids)
def test_without_state_id_returns_orders_without_any_logs(self):
resp = self.client.get(
self.url,