[FIX] tracking_manager: Avoid error if no record is linked (example: child_ids of res.partner)

Example use case:
- Define the child_ids field of res.partner as tracking.
- Modify contact Brandon Freeman and leave parent_id empty (Azure Interior)
- No error should be displayed

TT51146
pull/3048/head
Víctor Martínez 2024-10-07 08:36:09 +02:00
parent f8cf77a9b5
commit aeb1f6b6d7
1 changed files with 3 additions and 0 deletions

View File

@ -89,6 +89,9 @@ class Base(models.AbstractModel):
if not getattr(self.env[model_name], "message_post_with_view", False):
continue
for record_id, messages_by_field in model_data.items():
# Avoid error if no record is linked (example: child_ids of res.partner)
if not record_id:
continue
record = self.env[model_name].browse(record_id)
messages = [
{