Skip to content

[18][FIX] server_environment_data_encryption: keep sibling env fields cache consistent - #293

Open
florian-dacosta wants to merge 1 commit into
OCA:18.0from
akretion:18-fix-server-env-contraints
Open

[18][FIX] server_environment_data_encryption: keep sibling env fields cache consistent#293
florian-dacosta wants to merge 1 commit into
OCA:18.0from
akretion:18-fix-server-env-contraints

Conversation

@florian-dacosta

Copy link
Copy Markdown
Contributor

server.env.mixin env fields are non-stored computed fields whose value is read from encrypted.data. They have no field dependency on that storage, so writing one of them (through the inverse) does not recompute the others. In the web client save flow, a constraint that reads a sibling env field (e.g. microsoft_outlook validating smtp_encryption/smtp_user while smtp_authentication is saved) then sees a stale/empty value and raises a spurious ValidationError.

In _inverse_server_env, after storing the new value, refresh the cache of the sibling env fields from the values just written. Fields already present in cache are left untouched so a multi-field write does not clobber the freshly assigned values.

Steps to reproduce : install Odoo with microsf_outlook module.
Set the Connection Encryption to TLS and save.
Then select outlook on the "Authenticate with" field and save => You'll get a validation error from a constraint about the Connection Encryption that must be with TLS value, while it actually already is...
image

image

…he consistent

Writing one env-managed field left the cache of the other env fields stale: they are non-stored computed fields with no field dependency on the encrypted storage, so writing (via the inverse) did not recompute them. A constraint validating a sibling field then read a stale/empty value and raised incorrectly (e.g. microsoft_outlook checking smtp_encryption while saving smtp_authentication).
    After storing a value, refresh the cache of the sibling env fields from the values just written, skipping fields already in cache so that a multi-field write keeps each fields freshly assigned value.
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