[REVIEW] dms: contextual-creation defaults via active_* contract (lab-tested vs #29) - #30
Open
dnplkndll wants to merge 2 commits into
Open
[REVIEW] dms: contextual-creation defaults via active_* contract (lab-tested vs #29)#30dnplkndll wants to merge 2 commits into
dnplkndll wants to merge 2 commits into
Conversation
…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>
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.
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'sdefault_*andsearchpanel_default_*keys are sanitized client-side. Andparent_idis 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)
dms_parent_idkey + action rewritesdefault_*active_*contractWhat this carries
active_model/active_id— relocating the module's existing 18.0_default_parent_idcontract to where 19.0 resolves the field. No action changes, no custom context keys.{active_model, active_id}only), read-only-group + restricted-binary-URL + multipart upload/download tests, and theshow_timedate-only kanban fix.Domain([...])wraps (bare-list returns are the core + merged-OCA norm), action rewrites and custom keys.Validation
openupgrade-lab/test-results/dms-repro/showcase/Supersedes #29
Precedent for the
active_*contractcalendar/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_idresolve fromactive_*whendefault_*is absent.partner_multi_relation(res_partner_relation.createfalls back tocontext.get("active_id")forleft_partner_id);stock_inventory(stock_quant.createguarded byactive_model == "stock.inventory" and active_id);account_statement_base(default_journal_id: ctx.get("active_id")in an action context)._default_parent_id's first branch anddms_file._get_directory_from_contextalready rely onactive_model/active_id— this change relocates the module's own established contract to where 19.0 resolves the field.