[FIX] partner_multi_relation: make this_partner_id/other_partner_id searchable #2425
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 440 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.364
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2425"
general
weight: 0.35
NL66278
Problem
Odoo 19 warns when a computed field's
@dependschain crosses a non-storedfield that has no search method, because it cannot determine which records to
recompute when the dependency changes (
odoo/orm/fields.py,resolve_depends):this_partner_idandother_partner_idare computed, non-stored and declareno
search=. Any module defining a fieldrelated="this_partner_id.<x>"(oron
other_partner_id) raises that warning on every registry setup — and, moreimportantly, the related field is left without a reliable recompute trigger
when the underlying partner value changes.
Why not simplify the dependency
Both fields resolve to whichever of
left_partner_id/right_partner_idmatches the
current_partner_idcontext(
_compute_this_partner_id/_compute_other_partner_id), so there is nocontext-free column to search recompute candidates against. They genuinely need
a search method.
Fix
Each field gets its own search method mirroring its compute, side by side:
and the inverse pairing for
_search_other_partner_id. Without a currentpartner the domain collapses to the single side the compute falls back to.
The first version of this PR reused
_search_any_partner_idfor both fields.Review
correctly pointed out that it does not match the computes: it matches a partner
on either side, while each compute resolves to exactly one side.
Searching
this_partner_id = Xreturned relations whose computedthis_partner_idis a different partner, and withcurrent_partner_idincontext every result could be a false positive.
A cache bug the tests exposed
_get_current_partner()falls back toactive_model/active_id, but thecomputes only declared
@api.depends_context("current_partner_id"): a valuecomputed without context was reused verbatim in an
active_idcontext, so thecompute disagreed with itself depending on which context filled the cache
first. The computes now declare the two extra context keys, plus the
@api.depends("left_partner_id", "right_partner_id")that was missing forwrites to invalidate the cached aliases.
Tests
test_search_this_other_partner_matches_computeasserts search and computeagree record by record for both fields across the four context shapes: no
context, current partner on the left, current partner on the right, and
active_model/active_id.test_search_this_other_partner_by_namecovers anon-equality operator (
ilike) through the same side-aware domain.Full module suite on a clean 19.0 database: 0 failures.
Reproducing the original warning
Declare on any model a field
related="this_partner_id.<something>"overres.partner.relationand start the server: the warning is emitted once perregistry setup.