Skip to content

Commit

Permalink
Merge PR #3140 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Jan 24, 2025
2 parents b5aaba0 + c3fe07a commit 744f7f5
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions tracking_manager/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,22 @@ def _tm_notify_owner(self, mode, changes=None):
)
for field_name, owner_field_name in self._tm_get_fields_to_notify():
owner = self[field_name]
data[owner._name][owner.id][owner_field_name].append(
{
"mode": mode,
"record": self.display_name,
"changes": changes,
}
)
model_name = target_id = False
if isinstance(owner, models.BaseModel):
model_name = owner._name
target_id = owner.id
# In case of specific O2M (ex: ir.attachment with res_id)
elif isinstance(owner, int) and hasattr(self, "res_model"):
model_name = self.res_model
target_id = owner
if model_name and target_id:
data[model_name][target_id][owner_field_name].append(
{
"mode": mode,
"record": self.display_name,
"changes": changes,
}
)

def _tm_get_field_description(self, field_name):
return self._fields[field_name].get_description(self.env)["string"]
Expand Down

0 comments on commit 744f7f5

Please sign in to comment.