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
)
if has_access:
ref = f"{record.res_model},{record.res_id}"
record.related_model_instance = ref

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.

can't we catch an access error here instead?

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.

Yes indeed, I rewrote it, could you check again?

@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.

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