diff --git a/README.md b/README.md index 4775f338589..8dbbcc1bf2d 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ addon | version | maintainers | summary [sequence_python](sequence_python/) | 16.0.1.0.0 | | Calculate a sequence number from a Python expression [server_action_logging](server_action_logging/) | 16.0.1.0.0 | | Module that provides a logging mechanism for server actions [session_db](session_db/) | 16.0.1.0.6 | [![sbidoul](https://github.com/sbidoul.png?size=30px)](https://github.com/sbidoul) | Store sessions in DB -[tracking_manager](tracking_manager/) | 16.0.1.1.7 | [![Kev-Roche](https://github.com/Kev-Roche.png?size=30px)](https://github.com/Kev-Roche) [![sebastienbeau](https://github.com/sebastienbeau.png?size=30px)](https://github.com/sebastienbeau) | This module tracks all fields of a model, including one2many and many2many ones. +[tracking_manager](tracking_manager/) | 16.0.1.1.8 | [![Kev-Roche](https://github.com/Kev-Roche.png?size=30px)](https://github.com/Kev-Roche) [![sebastienbeau](https://github.com/sebastienbeau.png?size=30px)](https://github.com/sebastienbeau) | This module tracks all fields of a model, including one2many and many2many ones. [upgrade_analysis](upgrade_analysis/) | 16.0.1.2.0 | [![StefanRijnhart](https://github.com/StefanRijnhart.png?size=30px)](https://github.com/StefanRijnhart) [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) | Performs a difference analysis between modules installed on two different Odoo instances [url_attachment_search_fuzzy](url_attachment_search_fuzzy/) | 16.0.1.0.0 | [![mariadforgelow](https://github.com/mariadforgelow.png?size=30px)](https://github.com/mariadforgelow) | Fuzzy Search of URL in Attachments diff --git a/tracking_manager/README.rst b/tracking_manager/README.rst index 0a350343baf..b92f81d93f6 100644 --- a/tracking_manager/README.rst +++ b/tracking_manager/README.rst @@ -7,7 +7,7 @@ Tracking Manager !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:b231e128bb218863f9b542a551652904b428baca98def5a9f314c67c578d1908 + !! source digest: sha256:7e306300206048b2047afff4fe921b775b00a7a729541eb9fda3493170ab9aef !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/tracking_manager/__manifest__.py b/tracking_manager/__manifest__.py index b07fc4ad58f..def24ae6fe1 100644 --- a/tracking_manager/__manifest__.py +++ b/tracking_manager/__manifest__.py @@ -6,7 +6,7 @@ "name": "Tracking Manager", "summary": """This module tracks all fields of a model, including one2many and many2many ones.""", - "version": "16.0.1.1.7", + "version": "16.0.1.1.8", "category": "Tools", "website": "https://github.com/OCA/server-tools", "author": "Akretion, Odoo Community Association (OCA)", diff --git a/tracking_manager/models/models.py b/tracking_manager/models/models.py index 484aefc0445..db10d860849 100644 --- a/tracking_manager/models/models.py +++ b/tracking_manager/models/models.py @@ -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"] diff --git a/tracking_manager/static/description/index.html b/tracking_manager/static/description/index.html index 7c40966d469..f78631a1521 100644 --- a/tracking_manager/static/description/index.html +++ b/tracking_manager/static/description/index.html @@ -367,7 +367,7 @@
This module allows to track all fields on every model that has a chatter, including one2many and many2many ones. This excludes the computed, readonly, related fields by default.