You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up from the code-review discussion around #10 (xmlid-collision preflight, PR #224).
Idea
Today, relational fields (many2many / one2many) are always handled in Pass 2 (after all records are created). But a relation only needs deferral when it points at other rows created in the same import (forward references). A relation pointing at records that already exist in Odoo (e.g. existing res.partner.category tags, an existing country_id) can be written inline in the Pass-1 load() — no deferral, no second write, and crucially no external id required on the owning row.
Fewer RPCs (one load() instead of Pass 1 + a Pass-2 write pass) for the common "link to existing masters" case.
Simpler, more predictable behaviour.
Sketch
During strategy planning (preflight _plan_deferrals_and_strategies / _handle_m2m_field), classify each relational column:
references same-import rows (the column's values appear in this file's id column, or it's a self-reference) → keep deferring to Pass 2 (needs the ids created first);
references pre-existing records only → keep it in the Pass-1 payload (inline), skip the Pass-2 strategy for it.
Requires care for m2m/o2m value formats that load() accepts inline vs. what Pass 2 builds today, and for the (6,0) replace semantics (single-source-of-truth default we're keeping — see the 🌱 Initial Commit - Alpha Release Candidate #14 discussion).
Not urgent
This is an optimization + ergonomics improvement, not a correctness bug (the deferred path works). Filing so it isn't lost.
Refs: #224 (collision preflight), and the #14 additive-relations discussion.
Follow-up from the code-review discussion around #10 (xmlid-collision preflight, PR #224).
Idea
Today, relational fields (many2many / one2many) are always handled in Pass 2 (after all records are created). But a relation only needs deferral when it points at other rows created in the same import (forward references). A relation pointing at records that already exist in Odoo (e.g. existing
res.partner.categorytags, an existingcountry_id) can be written inline in the Pass-1load()— no deferral, no second write, and crucially no external id required on the owning row.Why it matters
load()instead of Pass 1 + a Pass-2 write pass) for the common "link to existing masters" case.Sketch
_plan_deferrals_and_strategies/_handle_m2m_field), classify each relational column:idcolumn, or it's a self-reference) → keep deferring to Pass 2 (needs the ids created first);load()accepts inline vs. what Pass 2 builds today, and for the(6,0)replace semantics (single-source-of-truth default we're keeping — see the 🌱 Initial Commit - Alpha Release Candidate #14 discussion).Not urgent
This is an optimization + ergonomics improvement, not a correctness bug (the deferred path works). Filing so it isn't lost.
Refs: #224 (collision preflight), and the #14 additive-relations discussion.