Skip to content

[18.0][FIX] web_m2x_options: prevent Owl crash when evaluateFieldBool…#3517

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
Studio73:18.0-web_m2x_options
Apr 23, 2026
Merged

[18.0][FIX] web_m2x_options: prevent Owl crash when evaluateFieldBool…#3517
OCA-git-bot merged 1 commit into
OCA:18.0from
Studio73:18.0-web_m2x_options

Conversation

@adrip-s73
Copy link
Copy Markdown
Contributor

@adrip-s73 adrip-s73 commented Apr 20, 2026

Describe the Bug

An UncaughtPromiseError > OwlError is triggered when opening standard views that contain m2m or m2o fields with domain-based creation rules, such as the stock.picking form view (Deliveries/Receipts) in Odoo 18.

Root Cause

The standard Odoo view defines the lot_ids field with the following option:
<field name="lot_ids" ... options="{'create': [('parent.use_create_lots', '=', True)]}" />

In JS, this domain is evaluated as an Array. The web_m2x_options module intercepts this through the evaluateFieldBooleanOption function in form.esm.js.
Currently, the function assumes the input is either a boolean or a string. When the Array is passed directly to Odoo's native evaluateBooleanExpr(option), JavaScript converts the array to a string ungracefully, generating an invalid python expression with commas instead of standard operators (bool(parent.use_create_lots,=,true)). This causes the Owl expression parser to fail and halt the entire rendering lifecycle.

Solution

Modified evaluateFieldBooleanOption to explicitly check the type of the option argument.
If the option is a boolean or a string, it evaluates it normally. If it receives an Array (an Odoo domain), it now returns true as a fallback. This prevents the module from sending malformed strings to the Owl evaluator and allows the view to load without crashing.

Error:
image

Copy link
Copy Markdown

@Reyes4711-S73 Reyes4711-S73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown

@pablo-cort-s73 pablo-cort-s73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@JoanSForgeFlow JoanSForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Member

@victoralmau victoralmau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional review OK

@pedrobaeza
Copy link
Copy Markdown
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Copy Markdown
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 18.0-ocabot-merge-pr-3517-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot
Copy link
Copy Markdown
Contributor

@pedrobaeza The merge process could not be finalized, because command git fetch origin refs/pull/3517/head:tmp-pr-3517 failed with output:

remote: Internal Server Error
fatal: unable to access 'https://github.com/OCA/web/': The requested URL returned error: 500

@pedrobaeza
Copy link
Copy Markdown
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 18.0-ocabot-merge-pr-3517-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 87766cb into OCA:18.0 Apr 23, 2026
9 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at e259618. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants