Skip to content

[19.0][FIX] server_environment: add search support for env-computed fields - #278

Open
AungKoKoLin1997 wants to merge 1 commit into
OCA:19.0from
qrtl:19.0-fix-server-env-search
Open

[19.0][FIX] server_environment: add search support for env-computed fields#278
AungKoKoLin1997 wants to merge 1 commit into
OCA:19.0from
qrtl:19.0-fix-server-env-search

Conversation

@AungKoKoLin1997

@AungKoKoLin1997 AungKoKoLin1997 commented Jul 22, 2026

Copy link
Copy Markdown

Summary

When server_environment transforms a field to an env-computed field, it sets store=False but does not provide a search method. This makes the field unusable in domain filters, e.g.:

storage_id = fields.Many2one(
    comodel_name="storage.backend",
    domain=[("backend_type", "=", "sftp")],
)

raises:

ValueError: Cannot convert storage.backend.backend_type to SQL because it is not stored

This was not an issue before Odoo 19 because the old domain processing (osv.expression) handled non-stored fields more leniently. Odoo 19's rewritten domain engine (odoo.orm.domains) strictly requires either store=True or an explicit search method.

Fix

Add a search method for env-computed fields following the same _partialmethod pattern already used for the inverse method.

@qrtl QT7028

@OCA-git-bot OCA-git-bot added mod:server_environment Module server_environment series:19.0 labels Jul 22, 2026
@AungKoKoLin1997
AungKoKoLin1997 force-pushed the 19.0-fix-server-env-search branch from 6cf2396 to 7ea5b66 Compare July 22, 2026 08:55
@AungKoKoLin1997 AungKoKoLin1997 changed the title [FIX] server_environment: add search support for env-computed fields [19.0][FIX] server_environment: add search support for env-computed fields Jul 22, 2026
When server_environment transforms a field to an env-computed field,
it sets store=False but does not provide a search method. This makes
the field unusable in domain filters, raising:

  ValueError: Cannot convert <field> to SQL because it is not stored

This was not an issue before Odoo 19 because the old domain processing
(osv.expression) handled non-stored fields more leniently. Odoo 19's
rewritten domain engine (odoo.orm.domains) strictly requires either
store=True or an explicit search method.

Add a search method for env-computed fields following the same
_partialmethod pattern already used for the inverse method.
@AungKoKoLin1997
AungKoKoLin1997 force-pushed the 19.0-fix-server-env-search branch from 7ea5b66 to 8f9c9aa Compare July 24, 2026 03:07
@AungKoKoLin1997
AungKoKoLin1997 marked this pull request as ready for review July 24, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:server_environment Module server_environment series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants