8000 [17.0][FIX] web_m2x_options: prevent crash on Many2OneReferenceField by Maarten-Van-Briel · Pull Request #3205 · OCA/web · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[17.0][FIX] web_m2x_options: prevent crash on Many2OneReferenceField #3205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 17.0
Choose a base branch
from

Conversation

Maarten-Van-Briel
Copy link
@Maarten-Van-Briel Maarten-Van-Briel commented Jun 25, 2025

without this patch, calling extractProps on Many2OneField with type "many2one_reference" to "this.m2o_options_props is not a function" errors because this method is undefined

this fix adds a no-op m2o_options_props implementation on Many2OneField with type "many2one_reference" to ensure compatibility and safely bypass the m2o_options_props logic since it's not relevant for reference fields

to reproduce this bug, open any view with many2one reference field, example automation rule form view with a "Vallues Updated"-trigger
image

@Maarten-Van-Briel Maarten-Van-Briel force-pushed the 17.0-web_m2x_options-fix-crash-on-many2onereferencefield branch from d8b900b to cf79f21 Compare June 25, 2025 10:15
Copy link
Contributor
@CRogos CRogos left a comment

Choose a reason for hiding this comment

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

I agree that this solves the issue, but I don't understand how this can happen? Is the extractProps mothod patched on an object where it should not be patched?

Comment on lines 179 to 181
if (type === "many2one_reference") {
return props;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How about solving this more generic?

Suggested change
if (type === "many2one_reference") {
return props;
}
if (!this.m2m_options_props){
return props;
}

@Maarten-Van-Briel Maarten-Van-Briel force-pushed the 17.0-web_m2x_options-fix-crash-on-many2onereferencefield branch from 05075ea to f92463d Compare July 4, 2025 08:53
@Maarten-Van-Briel Maarten-Van-Briel force-pushed the 17.0-web_m2x_options-fix-crash-on-many2onereferencefield branch from f92463d to 3622e59 Compare July 4, 2025 09:01
@Maarten-Van-Briel Maarten-Van-Briel requested a review from CRogos July 4, 2025 09:08
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.

3 participants
0