Skip to content
Open
Show file tree
Hide file tree
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
83 changes: 83 additions & 0 deletions mail_activity_unlink_log/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==============================
Mail Activities: log on unlink
==============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9196aedd490fc01c791256582122032365ce7d26a11a5c0e13b2ae66777b06c3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/19.0/mail_activity_unlink_log
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-19-0/social-19-0-mail_activity_unlink_log
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This addon enforces the creation of a message when an activity is
unlinked. This change tries to avoid a possible bad practice of deletion
of an activity without notifying the deletion.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_activity_unlink_log%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* CreuBlanca

Contributors
------------

- Enric Tobella
- Sumit Basak (`@TheSumitBasak <https://github.com/TheSumitBasak>`__)

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/social <https://github.com/OCA/social/tree/19.0/mail_activity_unlink_log>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions mail_activity_unlink_log/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions mail_activity_unlink_log/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 CreuBlanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Mail Activities: log on unlink",
"summary": """
Leave a message when an activity is unlinked""",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "CreuBlanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
"depends": ["mail"],
"data": ["data/unlink_message.xml"],
}
38 changes: 38 additions & 0 deletions mail_activity_unlink_log/data/unlink_message.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data noupdate="1">
<record id="mt_activities_unlink" model="mail.message.subtype">
<field name="name">Activities unlink</field>
<field name="default" eval="True" />
<field name="internal" eval="True" />
<field name="sequence" eval="90" />
</record>
</data>
<data>
<template id="message_activity_unlink">
<div>
<p>
<span
t-attf-class="fa #{activity.activity_type_id.icon} fa-fw"
/><span t-field="activity.activity_type_id.name" /> deleted
<t t-if="display_assignee"> (originally assigned to <span
t-field="activity.user_id.name"
/>)</t>
<span t-if="activity.summary">: </span><span
t-if="activity.summary"
t-field="activity.summary"
/>
</p>
<t
t-if="activity.note and activity.note != '&lt;p&gt;&lt;br&gt;&lt;/p&gt;'"
>
<!-- <p></br></p> -->
<div class="o_mail_note_title">
<strong>Original note:</strong>
</div>
<div t-field="activity.note" />
</t>
</div>
</template>
</data>
</odoo>
56 changes: 56 additions & 0 deletions mail_activity_unlink_log/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_activity_unlink_log
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Project-Id-Version header still references "Odoo Server 14.0" but this is a migration to 19.0. This should be updated to "Odoo Server 19.0" to match the module version in manifest.py.

Suggested change
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 19.0\n"

Copilot uses AI. Check for mistakes.
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-28 11:33+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: mail_activity_unlink_log
#: model_terms:ir.ui.view,arch_db:mail_activity_unlink_log.message_activity_unlink
msgid "(originally assigned to"
msgstr "(originalmente asignado a"

#. module: mail_activity_unlink_log
#: model_terms:ir.ui.view,arch_db:mail_activity_unlink_log.message_activity_unlink
msgid "<strong>Original note:</strong>"
msgstr "<strong>Nota original:</strong>"

#. module: mail_activity_unlink_log
#: model:mail.message.subtype,name:mail_activity_unlink_log.mt_activities_unlink
msgid "Activities unlink"
msgstr "Desvincular actividades"

#. module: mail_activity_unlink_log
#: model:ir.model,name:mail_activity_unlink_log.model_mail_activity
msgid "Activity"
msgstr "Actividades"

#. module: mail_activity_unlink_log
#: model:ir.model,name:mail_activity_unlink_log.model_mail_activity_mixin
msgid "Activity Mixin"
msgstr "Mezclador de Actividad"

#. module: mail_activity_unlink_log
#: model_terms:ir.ui.view,arch_db:mail_activity_unlink_log.message_activity_unlink
msgid "deleted"
msgstr "borrado"

#~ msgid "Display Name"
#~ msgstr "Mostrar Nombre"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Última Modificación el"
47 changes: 47 additions & 0 deletions mail_activity_unlink_log/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_activity_unlink_log
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Project-Id-Version header still references "Odoo Server 14.0" but this is a migration to 19.0. This should be updated to "Odoo Server 19.0" to match the module version in manifest.py.

Suggested change
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 19.0\n"

Copilot uses AI. Check for mistakes.
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-02-24 11:06+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

#. module: mail_activity_unlink_log
#: model_terms:ir.ui.view,arch_db:mail_activity_unlink_log.message_activity_unlink
msgid "(originally assigned to"
msgstr "(assegnato originariamente a"

#. module: mail_activity_unlink_log
#: model_terms:ir.ui.view,arch_db:mail_activity_unlink_log.message_activity_unlink
msgid "<strong>Original note:</strong>"
msgstr "<strong>Nota origine:</strong>"

#. module: mail_activity_unlink_log
#: model:mail.message.subtype,name:mail_activity_unlink_log.mt_activities_unlink
msgid "Activities unlink"
msgstr "Scollega attività"

#. module: mail_activity_unlink_log
#: model:ir.model,name:mail_activity_unlink_log.model_mail_activity
msgid "Activity"
msgstr "Attività"

#. module: mail_activity_unlink_log
#: model:ir.model,name:mail_activity_unlink_log.model_mail_activity_mixin
msgid "Activity Mixin"
msgstr "Mixin attività"

#. module: mail_activity_unlink_log
#: model_terms:ir.ui.view,arch_db:mail_activity_unlink_log.message_activity_unlink
msgid "deleted"
msgstr "cancellata"
44 changes: 44 additions & 0 deletions mail_activity_unlink_log/i18n/mail_activity_unlink_log.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_activity_unlink_log
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Project-Id-Version header still references "Odoo Server 18.0" but this is a migration to 19.0. This should be updated to "Odoo Server 19.0" to match the module version in manifest.py.

Suggested change
"Project-Id-Version: Odoo Server 18.0\n"
"Project-Id-Version: Odoo Server 19.0\n"

Copilot uses AI. Check for mistakes.
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mail_activity_unlink_log
#: model_terms:ir.ui.view,arch_db:mail_activity_unlink_log.message_activity_unlink
msgid "(originally assigned to"
msgstr ""

#. module: mail_activity_unlink_log
#: model_terms:ir.ui.view,arch_db:mail_activity_unlink_log.message_activity_unlink
msgid "<strong>Original note:</strong>"
msgstr ""

#. module: mail_activity_unlink_log
#: model:mail.message.subtype,name:mail_activity_unlink_log.mt_activities_unlink
msgid "Activities unlink"
msgstr ""

#. module: mail_activity_unlink_log
#: model:ir.model,name:mail_activity_unlink_log.model_mail_activity
msgid "Activity"
msgstr ""

#. module: mail_activity_unlink_log
#: model:ir.model,name:mail_activity_unlink_log.model_mail_activity_mixin
msgid "Activity Mixin"
msgstr ""

#. module: mail_activity_unlink_log
#: model_terms:ir.ui.view,arch_db:mail_activity_unlink_log.message_activity_unlink
msgid "deleted"
msgstr ""
1 change: 1 addition & 0 deletions mail_activity_unlink_log/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import mail_activity
39 changes: 39 additions & 0 deletions mail_activity_unlink_log/models/mail_activity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2023 CreuBlanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class MailActivity(models.Model):
_inherit = "mail.activity"

def _action_done(self, *args, **kwargs):
return super(
MailActivity, self.with_context(activity_unlink_no_message=True)
)._action_done(*args, **kwargs)

def unlink(self):
if not self.env.context.get("activity_unlink_no_message"):
for activity in self:
record = self.env[activity.res_model].browse(activity.res_id)
record.message_post_with_source(
"mail_activity_unlink_log.message_activity_unlink",
render_values={
"activity": activity,
"display_assignee": activity.user_id != self.env.user,
},
subtype_id=self.env["ir.model.data"]._xmlid_to_res_id(
"mail_activity_unlink_log.mt_activities_unlink"
),
Comment on lines +25 to +27
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method _xmlid_to_res_id is deprecated. In Odoo 19.0, you should use env.ref().id instead. Replace self.env["ir.model.data"]._xmlid_to_res_id("mail_activity_unlink_log.mt_activities_unlink") with self.env.ref("mail_activity_unlink_log.mt_activities_unlink").id

Suggested change
subtype_id=self.env["ir.model.data"]._xmlid_to_res_id(
"mail_activity_unlink_log.mt_activities_unlink"
),
subtype_id=self.env.ref(
"mail_activity_unlink_log.mt_activities_unlink"
).id,

Copilot uses AI. Check for mistakes.
mail_activity_type_id=activity.activity_type_id.id,
)
return super().unlink()


class MailActivityMixin(models.AbstractModel):
_inherit = "mail.activity.mixin"

def unlink(self):
return super(
MailActivityMixin, self.with_context(activity_unlink_no_message=True)
).unlink()
3 changes: 3 additions & 0 deletions mail_activity_unlink_log/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build-system.requires entry uses an unpinned third-party build backend (whool), which means every build can fetch an arbitrary, potentially compromised version of that package and execute it with access to your build environment and artifacts. An attacker who controls or poisons the whool package on the package index could tamper with built wheels or exfiltrate secrets from CI runners. Pin whool to a specific, vetted version (or other immutable identifier) to reduce supply-chain risk in the build step.

Copilot uses AI. Check for mistakes.
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions mail_activity_unlink_log/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Enric Tobella
- Sumit Basak ([@TheSumitBasak](https://github.com/TheSumitBasak))
3 changes: 3 additions & 0 deletions mail_activity_unlink_log/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This addon enforces the creation of a message when an activity is
unlinked. This change tries to avoid a possible bad practice of deletion
of an activity without notifying the deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading