Skip to content

[17.0][FIX] mail_activity_board: fix computing related_model_instance - #1875

Open
astirpe wants to merge 1 commit into
OCA:17.0from
astirpe:17_fix_mail_activity_board
Open

[17.0][FIX] mail_activity_board: fix computing related_model_instance#1875
astirpe wants to merge 1 commit into
OCA:17.0from
astirpe:17_fix_mail_activity_board

Conversation

@astirpe

@astirpe astirpe commented Jun 19, 2026

Copy link
Copy Markdown
Member

Issue: Loading the chatter crashes with a ValueError if a user lacks read access to an activity's related model. This happens because Odoo's ORM strictly validates assignments to Reference fields and rejects the restricted model.

Fix: Added a check inside _compute_related_model_instance. If the user cannot read the target model, the field safely defaults to False instead of crashing the entire view.

@OCA-git-bot OCA-git-bot added series:17.0 mod:mail_activity_board Module mail_activity_board labels Jun 19, 2026
@astirpe astirpe changed the title [17.0][FIX] mail_activity_board: fix computing related_model_instance… [17.0][FIX] mail_activity_board: fix computing related_model_instance Jun 19, 2026
@astirpe
astirpe marked this pull request as draft June 19, 2026 10:48
@astirpe
astirpe force-pushed the 17_fix_mail_activity_board branch from baf067f to f231ba4 Compare June 19, 2026 11:06
@astirpe
astirpe marked this pull request as ready for review June 19, 2026 11:13
Comment thread mail_activity_board/models/mail_activity.py Outdated
@astirpe
astirpe force-pushed the 17_fix_mail_activity_board branch from f231ba4 to da4d523 Compare June 26, 2026 11:29
Comment on lines +33 to +35
record.related_model_instance = (
f"{record.res_model},{record.res_id}"
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

shouldn't it be enough to wrap this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's not enough, it would reintroduce the crash we are trying to fix.
The original crash didn't occur during the compute method, which didn't fail itself. The crash would simply happen a moment later: when the web client tries to render the view, it attempts to fetch the target record's display name.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

but when will the else branch of this conditional throw any of the errors you catch here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

you are right, I just moved the else branch to outside the try-catch, thanks!

@astirpe
astirpe force-pushed the 17_fix_mail_activity_board branch from da4d523 to 37e41d2 Compare June 29, 2026 06:16
@astirpe
astirpe force-pushed the 17_fix_mail_activity_board branch from 37e41d2 to 3c4b513 Compare June 30, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:mail_activity_board Module mail_activity_board series:17.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants