Skip to content

feat(spp_drims): Requests review — UI/UX overhaul, per-warehouse allocation, reviewer notes - #396

Open
emjay0921 wants to merge 12 commits into
19.0from
fix/1075-drims-requests-review
Open

feat(spp_drims): Requests review — UI/UX overhaul, per-warehouse allocation, reviewer notes#396
emjay0921 wants to merge 12 commits into
19.0from
fix/1075-drims-requests-review

Conversation

@emjay0921

@emjay0921 emjay0921 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Why is this change needed?

OP#1075 (DRIMS - Full review - Requests) and all three of its children have passed QA — this raises the PR for that work, per the flow of opening PRs once QA signs off.

Ticket Status
OP#1075 DRIMS - Full review - Requests Test pass
OP#1079 Improve displaying of warehouses with available stock Test pass
OP#1161 Wire "Request Changes" button to capture reviewer notes Test pass
OP#1162 "Resubmit for Approval" fails with "Only draft records…" Test pass

What is in here

  • Requests UI/UX overhaul — Request Details aligned with the spec, allocated / not-allocated sections no longer padded with empty filler rows, request items and allocation tabs merged.
  • Per-warehouse allocation (OP#1079) — a new spp.drims.request.allocation model recording allocation per source warehouse, with stock.move.drims_allocation_id linking a move to the allocation it dispatches. The allocation wizard gained in-screen warehouse selection, clearer warnings, fulfillment %, and locked rows; source warehouse became optional.
  • Reviewer notes (OP#1161) — a spp.drims.request.revision.wizard so "Request Changes" captures a required note instead of silently bouncing the request back.
  • Resubmission (OP#1162) — action_resubmit, so a request sent back for revision can actually be resubmitted for approval.

Two things a reviewer should know

1. This branch was brought up to date by merging 19.0, not rebasing. It was already published, and rebasing would have rewritten shared history and required a force-push. Hence the merge commit.

2. One QA-passed behaviour was deliberately removed — see 7cdd47a2.

OP#1075 locked a dispatch's Operations list by making move_ids readonly, to stop products being added. But a readonly x2many also blocks editing Quantity, and entering less than Demand is exactly how a partial dispatch and its backorder are produced (OP#1087). The lock took the short-shipment flow out with it.

The same lock is implemented differently in OP#1057 (PR #391), which sets create/delete domains in the field's options: lines cannot be added or removed, while Quantity stays editable. It also adds stock.picking._check_drims_dispatch_matches_request, which refuses at validation any item not on the request and any quantity beyond what was allocated — covering RPC and imports, which a view attribute cannot.

Both branches edit the same //field[@name='move_ids']. Left as it was, readonly and options would both land and readonly would win, freezing quantities. So the readonly attribute is removed here and the OP#1057 lock governs.

This means QA signed off on a dispatch whose quantities could not be edited. If that was actually the desired behaviour rather than an untested side effect, say so and it can be reinstated — but OP#1087's partial-dispatch flow would then need rethinking.

Unit tests executed by the author

Full module suite on the merged branch:

0 failed, 0 error(s) of 263 tests

./spp lint clean. No test asserted the removed readonly attribute.

Unrelated and pre-existing, noted in passing: spp_drims/models/stock_warehouse.py:104 still calls read_group, deprecated since 19.0, which logs a DeprecationWarning traceback during the suite. Not a failure.

Related links

  • OP#1075 — DRIMS - Full review - Requests
  • OP#1079 — Improve displaying of warehouses with available stock
  • OP#1161 — Wire "Request Changes" button to capture reviewer notes
  • OP#1162 — "Resubmit for Approval" fails with "Only draft records…"

Notes for the reviewer

This branch carries readme/HISTORY.md and a regenerated static/description/index.html, which differs from how the other in-flight DRIMS branches are prepared — those leave the changelog for 19.0 after merge, to avoid conflicts between concurrent PRs on the same module. Left as the branch already had it; worth a consistency decision if several of these land together.

Overlap with the other open DRIMS PRs. This shares eight files with them — __manifest__.py, models/request.py, models/request_line.py, models/stock_move.py, security/ir.model.access.csv, tests/test_stock.py, views/stock_picking_views.xml, wizard/__init__.py — so whichever lands second will need a merge pass. #391 (OP#1057) is the one to watch, for the reason above.

Also worth knowing for OP#1151 (branch feat/1151-1150-drims-waybill-and-dispatch-page, pushed, PR not raised yet as it is still in QA): it exposes stock.move's DRIMS linkage fields in a view, but only the two that exist on 19.0. This branch adds a third, drims_allocation_id, which should be exposed alongside them once both are in.

🤖 Generated with Claude Code

emjay0921 added 12 commits July 15, 2026 10:25
- Overview list: hide the 'Code' column. It is the state field (related to
  state_id.code, label 'Code'); in Odoo 19 invisible="1" no longer hides a
  list column, so use column_invisible — keeps the field for row decorations.
- Form: reference fields (Incident, Cluster, Destination Area, Service Point,
  Destination Warehouse, Priority, Requested by) are display-only (no_open).
- Restructure the form into Request Details / Priority and Dates / Destination
  Information / Products; remove the Fulfillment section (the allocation wizard
  sets the source warehouse).
- Add a Destination Type selector (Warehouse | Service Point); the matching
  destination field is shown conditionally and the service point is filtered to
  the destination area.
- Flag allocation shortfall: a line where, post-approval, allocated < requested
  shows Quantity Allocated in red (is_allocation_short); the Allocate Stock
  button is hidden once the request is fully allocated (is_fully_allocated), and
  the 'Ready to Allocate' banner is replaced by a 'Fully Allocated' one.

Per-warehouse allocation split display is deferred to #1079.
The Allocate Stock wizard now opens without a source warehouse so the user
can first see which warehouses hold stock for the requested items, pick one,
and have it written back to the request. Adds a Source Warehouse field to the
request form (optional, editable while approved) so it can also be set before
opening the wizard.

- Warehouse suggestions now cover both the no-warehouse case (where stock is
  available) and the shortfall case (where else to look), using net
  availability.
- Confirm requires a warehouse with a clear message instead of failing on
  save; clearing the warehouse now clears stale lines.
- Fix line save failure when changing warehouse: the allocation line's
  product is now derived from the request line (stored related) so it is no
  longer a required readonly input omitted from the save payload.
Request Details now lists Incident, Humanitarian Cluster, Affected
Population, Justification and Requested by, in that order — Justification
moves into the section (the standalone Justification group is removed) and
the Contact Name / Phone fields (not part of the spec) are dropped from the
form.
…ent %, drop Still Needed column, lock rows (#1079)
Brings the branch up to date with 19.0 (13 commits) ahead of raising the
PR for OP#1075 and its children, which have passed QA. Merged rather than
rebased because the branch is already published.
OP#1075 locked a dispatch's Operations list by making the move_ids field
readonly, to stop products being added. A readonly x2many also blocks
editing Quantity, and entering less than Demand is how a partial dispatch
and its backorder are produced (OP#1087) — so the lock took the
short-shipment flow out with it.

Removed here in favour of the lock added by OP#1057, which sets
create/delete domains in the field's options: lines cannot be added or
removed, Quantity stays editable. That change also adds
stock.picking._check_drims_dispatch_matches_request, refusing at validation
any item not on the request and any quantity beyond what was allocated,
which covers RPC and imports as a view attribute never could.

Both branches edited the same field, so leaving this in place would have
left readonly and options fighting on the merged result, with readonly
winning and quantities frozen.

OP#1075 OP#1057
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.42%. Comparing base (208d975) to head (7cdd47a).

Files with missing lines Patch % Lines
spp_drims/wizard/allocation_preview_wizard.py 90.36% 8 Missing ⚠️
spp_drims/models/request_line.py 75.00% 6 Missing ⚠️
spp_drims/models/request.py 97.59% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #396      +/-   ##
==========================================
+ Coverage   70.17%   71.42%   +1.25%     
==========================================
  Files         205      243      +38     
  Lines       17751    20790    +3039     
==========================================
+ Hits        12457    14850    +2393     
- Misses       5294     5940     +646     
Flag Coverage Δ
spp_base_common 91.07% <ø> (ø)
spp_drims 82.24% <92.85%> (?)
spp_drims_sl_demo 66.85% <ø> (?)
spp_programs 65.27% <ø> (ø)
spp_registry 87.22% <ø> (+0.07%) ⬆️
spp_security 69.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
spp_drims/models/__init__.py 100.00% <100.00%> (ø)
spp_drims/models/request_allocation.py 100.00% <100.00%> (ø)
spp_drims/models/stock_move.py 100.00% <100.00%> (ø)
spp_drims/wizard/__init__.py 100.00% <100.00%> (ø)
spp_drims/wizard/request_revision_wizard.py 100.00% <100.00%> (ø)
spp_drims/models/request.py 93.19% <97.59%> (ø)
spp_drims/models/request_line.py 82.35% <75.00%> (ø)
spp_drims/wizard/allocation_preview_wizard.py 92.91% <90.36%> (ø)

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@emjay0921
emjay0921 marked this pull request as ready for review August 7, 2026 02:29
@emjay0921
emjay0921 marked this pull request as draft August 7, 2026 03:42
@emjay0921
emjay0921 marked this pull request as ready for review August 7, 2026 03:43
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