Commit 469caae
committed
[FIX] mail: message related to deleted record doesn't break discuss
Before this commit, when a message notification from inbox or
history has its related record deleted, the user couldn't load
inbox or history.
Steps to reproduce:
- Have mitchell admin receive notification in Odoo
- Install `mail_group`
- Wait a few seconds to receive following user_notification
from mail group:
```
on My Company News
Hello,
You have messages to moderate, please go for the proceedings.
```
- Go to related record then delete it
- Go back to inbox or history
=> One of them show `An error occurred while fetching messages.`
This happens because the related record is not a `mail.thread`,
but still creates some `mail.message` to send user notifications.
`mail.thread` cascade delete the messages in message list, but
threadless records do not. Because the related record is deleted,
these messages are attempted to be displayed in mailbox, but due
to related record having no `display_name` by non-existing, the
fetch data of inbox/history crashes with:
```
MissingError: Record does not exist or has been deleted
```
This commit fixes the issue by doing its best to show message
even when the related record has been deleted.
opw-4546920
closes odoo#219791
X-original-commit: c922d6d
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>1 parent 159f82a commit 469caae
3 files changed
Lines changed: 17 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
1033 | 1034 | | |
1034 | 1035 | | |
1035 | 1036 | | |
| 1037 | + | |
| 1038 | + | |
1036 | 1039 | | |
1037 | 1040 | | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1043 | 1048 | | |
1044 | 1049 | | |
1045 | 1050 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
215 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
216 | 220 | | |
217 | 221 | | |
218 | 222 | | |
| |||
0 commit comments