Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][UPD][FIX] tracking_manager: specific O2M fields notify #3140

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
)
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

Check warning on line 59 in tracking_manager/models/models.py

View check run for this annotation

Codecov / codecov/patch

tracking_manager/models/models.py#L58-L59

Added lines #L58 - L59 were not covered by tests
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
Loading