Skip to content

[FIX] pms_api_rest: allow module data loads to write on the various partner#106

Open
DarioLodeiros wants to merge 1 commit into
16.0from
16.0-fix-various-partner-guard-install-mode
Open

[FIX] pms_api_rest: allow module data loads to write on the various partner#106
DarioLodeiros wants to merge 1 commit into
16.0from
16.0-fix-various-partner-guard-install-mode

Conversation

@DarioLodeiros

Copy link
Copy Markdown
Member

Problem

The various-partner write guard introduced in 1cc158f blocks every write on protected fields of pms.various_pms_partner, including writes performed by module XML data loading.

On a fresh install (new database with the full addon set), pms_l10n_es_sii sets aeat_anonymous_cash_customer on that partner from its data/pms_data.xml:

odoo.exceptions.UserError: The system contact 'Various Clients' is reserved for simplified invoices and cannot be modified. Blocked fields: aeat_anonymous_cash_customer. ...
odoo.tools.convert.ParseError: while parsing .../pms_l10n_es_sii/data/pms_data.xml:4
CRITICAL ... Failed to initialize database

The registry fails to load and the database cannot be initialized at all.

Existing databases never hit this because that record is noupdate="1" and was written before the guard existed — the bug only surfaces on new deployments (e.g. self-hosted installs reproducing our addons tree).

Fix

Bypass the guard when install_mode is set in the context, which BaseModel._load_records only sets during module install/upgrade data loading. Runtime writes coming from the REST API or the UI remain blocked, which is what the guard was added for.

Includes a regression test.

🤖 Generated with Claude Code

…artner

The various-partner guard (1cc158f) blocks every write on protected
fields, including writes performed by module XML data loading. On a
fresh install, pms_l10n_es_sii sets aeat_anonymous_cash_customer on
pms.various_pms_partner from data/pms_data.xml, so the registry fails
to load and the database cannot be initialized. Existing databases
never hit this because that record is noupdate and was written before
the guard existed.

Bypass the guard when install_mode is set in the context, which
BaseModel._load_records only sets during module install/upgrade data
loading. Runtime writes coming from the REST API or the UI remain
blocked.
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Diff Coverage

Diff: origin/16.0...HEAD, staged and unstaged changes

  • pms_api_rest/models/res_partner.py (100%)

Summary

  • Total: 2 lines
  • Missing: 0 lines
  • Coverage: 100%

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.

1 participant