Skip to content

[REVIEW] dms: contextual-creation defaults via active_* contract (lab-tested vs #29) - #30

Open
dnplkndll wants to merge 2 commits into
19.0-mig-dmsfrom
19.0-mig-dms-ctxfix
Open

[REVIEW] dms: contextual-creation defaults via active_* contract (lab-tested vs #29)#30
dnplkndll wants to merge 2 commits into
19.0-mig-dmsfrom
19.0-mig-dms-ctxfix

Conversation

@dnplkndll

@dnplkndll dnplkndll commented Jul 7, 2026

Copy link
Copy Markdown

Isolated comparison against the OCA#475 head — the lab-tested alternative to #29's custom-context-key approach.

Empirical basis (openupgrade-lab, real UI clicks, videos)

Server-side context logging during the smart-button → New flow shows 19.0 delivers only active_model/active_id/active_ids (+ genuinely custom keys) — the action's default_* and searchpanel_default_* keys are sanitized client-side. And parent_id is computed-writable, so the value resolves in the compute, where the old self-assign HACK preserves nothing on new records.

4-way shootout (same Playwright flows, before/after videos)

approach fixed? impl diff
OCA#475 head (before)
#29: custom dms_parent_id key + action rewrites 8 files, +146/−35
searchpanel-key fallback ✗ (also sanitized)
fresh-context plain default_* ✗ (sanitized)
this PR: active_* contract 2 impl files, ~19 lines

What this carries

  • Compute/default fallback via active_model/active_id — relocating the module's existing 18.0 _default_parent_id contract to where 19.0 resolves the field. No action changes, no custom context keys.
  • From [FIX] dms: complete Odoo 19 migration fixes #29 (@Erp4759, commit author): the regression test (rewritten to the real client contract: context = {active_model, active_id} only), read-only-group + restricted-binary-URL + multipart upload/download tests, and the show_time date-only kanban fix.
  • Dropped from [FIX] dms: complete Odoo 19 migration fixes #29: Domain([...]) wraps (bare-list returns are the core + merged-OCA norm), action rewrites and custom keys.

Validation

  • 68/68 with-demo · 68/68 no-demo (OCA-CI style) · ruff clean
  • Playwright flows green; videos: openupgrade-lab/test-results/dms-repro/showcase/

Supersedes #29

Precedent for the active_* contract

  • Odoo core calendar/models/calendar_event.py (19.0, default_get): literally commented "support active_model / active_id as replacement of default_ if not already given"* — res_model_id/res_id resolve from active_* when default_* is absent.
  • OCA merged: partner_multi_relation (res_partner_relation.create falls back to context.get("active_id") for left_partner_id); stock_inventory (stock_quant.create guarded by active_model == "stock.inventory" and active_id); account_statement_base (default_journal_id: ctx.get("active_id") in an action context).
  • dms itself: _default_parent_id's first branch and dms_file._get_directory_from_context already rely on active_model/active_id — this change relocates the module's own established contract to where 19.0 resolves the field.

dnplkndll and others added 2 commits June 23, 2026 06:53
…nban

The 19.0 web client sanitizes default_* and searchpanel_default_* out of
the context it sends when creating a record from a contextual child view
(smart button -> New); only active_model/active_id survive. parent_id is
computed-writable, so the value resolves in the compute, where the old
self-assign no longer preserves anything on new records. Resolve the
parent/directory from the surviving active_model/active_id keys — the
same contract _default_parent_id already used — in the compute and the
file's directory_id default.

Also: date-only rendering of write_date via the datetime option
(show_time: false) instead of widget="date", and regression tests for
contextual defaults, read-only access groups, restricted binary URLs and
multipart upload/download.

Co-authored-by: Don Kendall <dkendall@ledoweb.com>
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