[18.0][FIX] web_m2x_options: prevent Owl crash when evaluateFieldBool…#3517
Merged
Conversation
…eanOption receives an Array domain
LauraCForgeFlow
approved these changes
Apr 22, 2026
carlos-lopez-tecnativa
approved these changes
Apr 23, 2026
pilarvargas-tecnativa
approved these changes
Apr 23, 2026
Member
|
/ocabot merge patch |
Contributor
|
What a great day to merge this nice PR. Let's do it! |
Contributor
|
@pedrobaeza The merge process could not be finalized, because command |
Member
|
/ocabot merge patch |
Contributor
|
On my way to merge this fine PR! |
Contributor
|
Congratulations, your PR was merged at e259618. Thanks a lot for contributing to OCA. ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the Bug
An
UncaughtPromiseError > OwlErroris triggered when opening standard views that containm2morm2ofields with domain-based creation rules, such as thestock.pickingform view (Deliveries/Receipts) in Odoo 18.Root Cause
The standard Odoo view defines the
lot_idsfield with the following option:<field name="lot_ids" ... options="{'create': [('parent.use_create_lots', '=', True)]}" />In JS, this domain is evaluated as an
Array. Theweb_m2x_optionsmodule intercepts this through theevaluateFieldBooleanOptionfunction inform.esm.js.Currently, the function assumes the input is either a
booleanor astring. When the Array is passed directly to Odoo's nativeevaluateBooleanExpr(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
evaluateFieldBooleanOptionto explicitly check the type of theoptionargument.If the option is a
booleanor astring, it evaluates it normally. If it receives anArray(an Odoo domain), it now returnstrueas a fallback. This prevents the module from sending malformed strings to the Owl evaluator and allows the view to load without crashing.Error:
