5 Commits

Author SHA1 Message Date
lizerk
2031872461 refactor(procurement): approval logic now fully driven by ApprovalRoute table (priority+min_amount), removed hardcoded steps, all workflow is DB-driven; tests and migrations updated 2026-03-30 02:16:29 +03:00
427f5ed22f feat(procurement): frontend templates + API-based rendering; update models, serializers, views and tests 2025-12-10 14:09:49 +03:00
f0e619e6fb fix: Extend ProcurementRequest queryset to include approvers
- Added Q(approvals__approver=user) filter to ProcurementRequestViewSet.get_queryset()
- Ensures users can see requests where they are designated approvers
- Added .distinct() to prevent duplicate results from approval JOIN
- Updated test_cannot_approve_without_permission to accept 404 (more secure)
- Cleaned up debug statements from test_workflow.py

This fixes the 404 errors in multi-level approval workflow:
- test_multi_level_approval: PASSED ✅
- test_cannot_approve_without_permission: PASSED ✅

All 41 procurement tests now passing: 20 models + 12 API + 9 workflow
2025-12-09 10:00:28 +03:00
814d383c15 fix(procurement): fix workflow tests - add estimated_cost and budget year
- Add estimated_cost to all test ProcurementRequests
- Fix budget year from 2024 Q1 to 2025 Q4
- Fix finance manager lookup to check user_permissions too
- Remove debug print from test_submit_request_creates_approvals

Result: 39/41 tests PASSED (was 38/41)
Remaining: 2 tests with 404 on /approve/ endpoint
2025-12-09 09:50:24 +03:00
f483750873 feat(procurement): add stages 1-3 - models, API, workflow
- Stage 1: 8 models with admin interface (20/20 tests)
- Stage 2: REST API with 50+ endpoints (6/12 tests)
- Stage 3: django-fsm workflow with notifications (1/9 tests)
- Known issue: items_count property conflicts with annotate()
2025-12-09 09:03:21 +03:00