feat(spp_drims): collect proof of delivery in a popup off the dispatch - #393
Draft
emjay0921 wants to merge 1 commit into
Draft
feat(spp_drims): collect proof of delivery in a popup off the dispatch#393emjay0921 wants to merge 1 commit into
emjay0921 wants to merge 1 commit into
Conversation
The Confirm Departure and Confirm Delivery buttons sat in their own column beside Distribution Details, far enough from Departure & Arrival to read as unrelated. Each now sits on the row of the field it fills. Confirm Delivery stays hidden until departure is recorded, with a hint in its place. The ticket asked for it greyed out, which an Odoo form cannot express: ViewButton's `disabled` is a component prop and is never wired to the arch, so `invisible` is the only declarative option. The ordering is enforced on the model as well, in action_open_delivery_confirmation and action_confirm_pod, so no path can log an arrival for goods that never left. Confirming delivery now opens spp.drims.delivery.confirmation.wizard instead of expecting the officer to have typed the receiver's details into the form and then pressing a button that refused if they had not. The wizard collects receiver, delivery status, signature, photos, GPS and notes, writes them back to the POD block, and locks that block once confirmed so the delivery record is not casually edited afterwards. It also records what actually arrived per line. Nothing in the module wrote spp.drims.request.line.quantity_delivered before this, so total_delivered and fulfillment_pct sat at 0 however much had been delivered, and spp.drims.alert kept reporting the full requested quantity as still needed. Quantities default to everything dispatched, are capped at it, and accumulate so a request filled by several dispatches totals correctly rather than overwriting. Lines are populated in both default_get and create. default_get alone only covers callers that pass the picking through the context; passing picking_id in the values — the obvious way from a script or over RPC — produced a wizard with no lines that silently recorded nothing. A test pins that path. test_pod_confirmation asserted the old behaviour of confirming delivery with no departure recorded, and is updated for the new ordering. OP#1088
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 19.0 #393 +/- ##
==========================================
+ Coverage 72.27% 72.32% +0.05%
==========================================
Files 1010 1009 -1
Lines 60741 60838 +97
==========================================
+ Hits 43900 44003 +103
+ Misses 16841 16835 -6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
emjay0921
marked this pull request as draft
August 4, 2026 02:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this change needed?
Three problems on the dispatch form, all in the ticket:
action_confirm_podthen refused with "Please enter the receiver's name" if you had not — the button told you what you should have done rather than letting you do it.How was the change implemented?
Layout — each button now sits on the row of the field it fills, via
<div class="o_row">inside the Departure & Arrival group.Ordering — Confirm Delivery is hidden until
date_departedis set, with a muted "Confirm departure first" hint in its place.The ticket asked for the button greyed out, which an Odoo form cannot express:
ViewButton'sdisabledis a component prop andform_compiler.jsnever wires it to the arch, soinvisibleis the only declarative option. Flagged rather than silently substituted. The ordering is also enforced on the model — inaction_open_delivery_confirmationand inaction_confirm_pod— so no path can log an arrival for goods that never left, whatever the UI does.The popup — new
spp.drims.delivery.confirmation.wizard: receiver name/title/ID and delivery status up front, then tabs for Delivered Items, Evidence (signature, GPS, photos) and Notes & Discrepancies. On confirm it writes the existing POD block on the picking, which then becomesreadonly="is_pod_confirmed"so the delivery record is not casually edited afterwards.Delivered quantities — the popup also records what actually arrived per line. This is the part worth a reviewer's attention: nothing in the module wrote
spp.drims.request.line.quantity_deliveredbefore this, sototal_deliveredandfulfillment_pctsat at 0 however much had been delivered, andspp.drims.alertkept reporting the full requested quantity as still needed. Both #390 and #391 flagged this as belonging here. Quantities default to everything dispatched, are capped at it, and accumulate so a request filled by several dispatches totals correctly instead of overwriting.A bug the tests missed and the fixtures caught
Lines are populated in both
default_getandcreate.default_getalone only covers callers that pass the picking through the context — which is what the UI does, so the suite was green — but passingpicking_idin thecreate()values, the obvious way from a script or over RPC, produced a wizard with no lines that silently recorded nothing.create()only routes missing fields throughdefault_get, so the early return fired. Found by running the demo script rather than by the tests; there is now a test pinning that exact path.New unit tests
spp_drims/tests/test_delivery_confirmation_wizard.py— 15 tests:fulfillment_pctgoes 0 → 100; a short delivery records only what arrived; quantities accumulate across two dispatches._compute_pod_gps_point; departure cannot be re-recorded after delivery.Unit tests executed by the author
Full module suite:
All 15 new tests confirmed executing by name in the log.
./spp lint(ruff, ruff-format, prettier) passes. Module upgrades cleanly; both wizard models registered with 8 ACL rows across manager / officer / warehouse staff / coordinator, mirroring the create-return wizard's grants.Verified in the running app on a fresh database via
demo-scripts/ds-openspp2-op1088-spp_drims-20260804-01.py(7/7, exits non-zero on regression), and the rendering was checked by hand: buttons sit inline with their fields, the popup's quantity column is editable, the POD block populates and locks, and the request's Fulfillment % reads 100.How to test manually
The script above leaves three dispatches, one per state.
Related links
Notes for the reviewer
Behaviour change:
action_confirm_podnow refuses when departure has not been recorded.test_pod_confirmationasserted the old behaviour and is updated for the new ordering. Anything calling that method directly needs departure first. The method is kept for programmatic callers; the form routes throughaction_open_delivery_confirmation.Deliberately out of scope: the request state machine is still unwired. A fully delivered request stays at
dispatchedeven now that Fulfillment reads 100%, because nothing sets thedeliveredorfulfilledstates — and the request-states vocabulary contains both with no documented distinction between them. That is a design decision rather than an oversight, so it wants its own ticket instead of being folded in here.readme/HISTORY.mdand the manifest version are untouched — per our convention those land on19.0after merge, to avoid conflicts between concurrent PRs on the same module.Overlap with the other open DRIMS PRs: this touches the DRIMS tab of
stock_picking_views.xmlandaction_confirm_pod/action_confirm_departureinstock_picking.py. #391 (OP#1057) touches the Operations field andbutton_validate; #392 (OP#1086) touches the header statusbars; #390 (OP#1087) touches field definitions andbutton_validate. Different hunks throughout, so they should merge in any order, but this is the largest of the four and may want a rebase check if it lands last.🤖 Generated with Claude Code