Skip to content

TJK: Document upload in putaway flow#4

Open
deeonwuli wants to merge 4 commits into
release/est/tjk/0.9.7from
feat/document-upload-in-putaway-flow
Open

TJK: Document upload in putaway flow#4
deeonwuli wants to merge 4 commits into
release/est/tjk/0.9.7from
feat/document-upload-in-putaway-flow

Conversation

@deeonwuli
Copy link
Copy Markdown

📌 References

📝 Implementation

  • Broaden activity-code labels (4 keys in grails-app/i18n/messages.properties + matching ru/tg translations):
    • "Require document on outbound stock transfer" → "Require document on outbound"
    • "Require document on inbound stock transfer" → "Require document on inbound"
  • Generalized the existing React panel under src/js/custom/stockTransferDocuments/:
    • Renamed StockTransferDocumentsPanel.jsxSupportingDocumentsPanel.jsx (component, SCSS file, BLOCK class, test all renamed).
    • New props: entityId (replaces stockTransferId), apiBasePath, requiredWarning, panel is now entity-agnostic.
    • API helper (utils/api.js) parameterised by base path instead of hardcoding /api/custom/stockTransfers.
  • New putaway-documents custom feature under org.pih.warehouse.custom.putawayDocuments.*:
    • CustomPutawayDocumentService — thin wrapper that resolves Putaway.id → Order.get(id) and delegates to the already-generic CustomStockTransferDocumentService
    • CustomPutawayDocumentController exposing GET /api/custom/putaways/{id}/documents and POST /api/custom/putaways/{id}/documents (multipart), mirroring the stock-transfer controller.
    • New URL mapping in grails-app/controllers/org/pih/warehouse/UrlMappings.groovy.
  • SupportingDocumentsPanel added on putaway completion page

✨ Description of Change

Add a "Supporting documents" panel to the Putaway completion step that requires at least one document attached before "Complete Putaway" is allowed, gated by the existing REQUIRE_TRANSFER_IN_DOCUMENT activity code on the destination warehouse. Reuses the panel, service, and document storage (Order.documents) introduced by the stock-transfer-documents feature.

📷 Screenshots & Recordings (optional)

Screenshot 2026-05-19 at 18 33 01
Screen.Recording.2026-05-19.at.19.08.10.mov

🔥 Notes to the tester

To run

cd docker && docker compose up -d db
cd .. && ./gradlew bootRun -Dserver.port=8081
  1. Label rename — English: open /openboxes/locationType/edit/2 (Depot location type). In the "Supported Activities" dropdown, the two checkboxes that previously read "Require document on outbound stock transfer" / "Require document on inbound stock transfer" now read "Require document on outbound" / "Require document on inbound".
  2. Putaway happy path (doc required):
    • With "Require document on inbound" enabled on the location, create an inbound stock movement that generates a putaway.
    • Navigate through step 1 → step 2 → step 3 (/openboxes/putAway/create/).
    • The "Supporting documents *" panel renders on the Complete page.
    • Both "Complete Putaway" buttons are disabled. The panel shows "A document must be attached before this putaway can be completed".
    • Drop a file (PDF/image/Word/Excel/CSV/ZIP, ≤10 MB) → upload succeeds → warning clears → buttons enable.
    • Click "Complete Putaway" → 200, putaway status transitions to COMPLETED, stock is transferred to the destination bin.
  3. Putaway happy path (doc NOT required): untick "Require document on inbound" on the destination warehouse. Same flow → the panel still renders (so users can attach optional docs) but no warning, and "Complete Putaway" is enabled even with no docs.

#869dbr57h

deeonwuli added 2 commits May 19, 2026 18:13
- Implemented a new controller `CustomPutawayDocumentController` to handle document listing and uploading for putaways.
- Added routes in `UrlMappings.groovy` for document upload and retrieval.
- Created `CustomPutawayDocumentService` to manage document-related business logic.
- Updated `PutawayService` to validate document requirements during putaway completion.
- Introduced a new React component `SupportingDocumentsPanel` for handling document uploads in the UI.
- Added tests for the `SupportingDocumentsPanel` to ensure proper functionality and error handling.
- Updated internationalization files to include messages related to document requirements and errors.
- Refactored existing API utility functions to support the new document handling logic.
@deeonwuli deeonwuli changed the title Feat/document upload in putaway flow [feature]: Document upload in putaway flow May 19, 2026
@gqcorneby gqcorneby changed the title [feature]: Document upload in putaway flow TJK: Document upload in putaway flow May 20, 2026
Copy link
Copy Markdown

@gqcorneby gqcorneby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks @deeonwuli! Works great! Just one minor thing, non-blocking.
src/js/custom/stockTransferDocuments/components is now used in stock transfers and putaways. Maybe we can rename the folder to just supportingDocuments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants