Repository: OCA/mail
Pull request #31: [18.0][MIG] mail_activity_done: Migration to 18.0
Author: login: StefanRijnhart
Labels: name: approved
name: ready to merge
name: merged 🎉
Created: 2025-02-12T14:54:02Z | Merged: 2025-05-09T15:42:37Z

Continued from https://github.com/OCA/mail/pull/17

The functionality is now supported by Odoo, using a similar datamodel: to mark activities done, they are archived instead of unlinked. This is reflected in the way that the state field is computed.

We can keep this module to ensure that all activity types default to keeping done activities (which is not the case in Odoo). Otherwise, the migration script will also clear archived activities that were not done, to prevent them from showing up as 'done' in Odoo 18.


Diff:
diff --git a/mail_activity_done/README.rst b/mail_activity_done/README.rst
new file mode 100644
index 000000000..08705326e
--- /dev/null
+++ b/mail_activity_done/README.rst
@@ -0,0 +1,95 @@
+==================
+Mail Activity Done
+==================
+
+.. 
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   !! This file is generated by oca-gen-addon-readme !!
+   !! changes will be overwritten.                   !!
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   !! source digest: sha256:5a0ce87bede46ee3ef4aca69080182899705bb737283ce6f2e369921f635edf0
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+.. |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/licence-LGPL--3-blue.png
+    :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
+    :alt: License: LGPL-3
+.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmail-lightgray.png?logo=github
+    :target: https://github.com/OCA/mail/tree/18.0/mail_activity_done
+    :alt: OCA/mail
+.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
+    :target: https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_activity_done
+    :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/mail&target_branch=18.0
+    :alt: Try me on Runboat
+
+|badge1| |badge2| |badge3| |badge4| |badge5|
+
+This module implements the capability to keep activities that have been
+completed, for future reporting, by setting them with the boolean
+'Done'.
+
+Since Odoo 18.0, this is supported natively by Odoo, depending on the
+configuration of the activity types. This module ensures that the option
+is active on all existing and new activity types in your setup.
+
+**Table of contents**
+
+.. contents::
+   :local:
+
+Usage
+=====
+
+To use this module, you do not need to do anything.
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub Issues <https://github.com/OCA/mail/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/mail/issues/new?body=module:%20mail_activity_done%0Aversion:%2018.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
+-------
+
+* ForgeFlow
+
+Contributors
+------------
+
+-  Jordi Ballester <jordi.ballester@forgeflow.com>
+   (`www.forgeflow.com <http://www.forgeflow.com>`__)
+-  Eduardo Magdalena <emagdalena@c2i.es> (C2i Change 2 improve
+   http://www.c2i.es)
+-  Radovan Skolnik <radovan@skolnik.info> (https://www.kema.sk)
+-  Manuel Regidor <manuel.regidor@sygel.es> (https://www.sygel.es)
+-  Bernat Puig <bernat.puig@forgeflow.com>
+   (`www.forgeflow.com <http://www.forgeflow.com>`__)
+-  Stefan Rijnhart <stefan@opener.amsterdam>
+
+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/mail <https://github.com/OCA/mail/tree/18.0/mail_activity_done>`_ project on GitHub.
+
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/mail_activity_done/__init__.py b/mail_activity_done/__init__.py
new file mode 100644
index 000000000..cc6b6354a
--- /dev/null
+++ b/mail_activity_done/__init__.py
@@ -0,0 +1,2 @@
+from . import models
+from .hooks import post_init_hook
diff --git a/mail_activity_done/__manifest__.py b/mail_activity_done/__manifest__.py
new file mode 100644
index 000000000..bec254929
--- /dev/null
+++ b/mail_activity_done/__manifest__.py
@@ -0,0 +1,12 @@
+# Copyright 2018-22 ForgeFlow <http://www.forgeflow.com>
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+{
+    "name": "Mail Activity Done",
+    "version": "18.0.1.0.0",
+    "author": "ForgeFlow, Odoo Community Association (OCA)",
+    "license": "LGPL-3",
+    "category": "Discuss",
+    "website": "https://github.com/OCA/mail",
+    "depends": ["mail"],
+    "post_init_hook": "post_init_hook",
+}
diff --git a/mail_activity_done/hooks.py b/mail_activity_done/hooks.py
new file mode 100644
index 000000000..af0520754
--- /dev/null
+++ b/mail_activity_done/hooks.py
@@ -0,0 +1,18 @@
+# Copyright 2018-22 ForgeFlow <http://www.forgeflow.com>
+# Copyright 2018 Odoo, S.A.
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+
+
+def _set_keep_done(cr):
+    """Set keep_done to true for all existing activity types"""
+    cr.execute(
+        """
+        update mail_activity_type
+        set keep_done = true
+        where keep_done is not true
+        """
+    )
+
+
+def post_init_hook(env):
+    _set_keep_done(env.cr)
diff --git a/mail_activity_done/i18n/es.po b/mail_activity_done/i18n/es.po
new file mode 100644
index 000000000..c453e069d
--- /dev/null
+++ b/mail_activity_done/i18n/es.po
@@ -0,0 +1,101 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* mail_activity_done
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 16.0\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: 2023-11-08 13:36+0000\n"
+"Last-Translator: Ivorra78 <informatica@totmaterial.es>\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_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__active
+msgid "Active"
+msgstr "Activo"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_bank_statement_line__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_journal__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_move__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_payment__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_setup_bank_manual_config__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mailing_mailing__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_pricelist__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_product__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_template__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner_bank__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids
+msgid "Activities"
+msgstr "Actividades"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity
+msgid "Activity"
+msgstr "Actividad"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity_mixin
+msgid "Activity Mixin"
+msgstr "Mezclador de Actividad"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Completed Activities"
+msgstr "Actividades Completadas"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__date_done
+msgid "Completed Date"
+msgstr "Completado Fecha"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done
+#: model:ir.model.fields.selection,name:mail_activity_done.selection__mail_activity__state__done
+msgid "Done"
+msgstr "Hecho"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Open Activities"
+msgstr "Actividades Abiertas"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state
+msgid "State"
+msgstr "Estado"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_res_users
+msgid "User"
+msgstr "Usuario"
+
+#, python-format
+#~ msgid "%d days overdue"
+#~ msgstr "%d días de retraso"
+
+#, python-format
+#~ msgid "Due in %d days"
+#~ msgstr "Vencimiento en %d días"
+
+#, python-format
+#~ msgid "Today"
+#~ msgstr "Hoy"
+
+#, python-format
+#~ msgid "Tomorrow"
+#~ msgstr "Mañana"
+
+#, python-format
+#~ msgid "Yesterday"
+#~ msgstr "Ayer"
diff --git a/mail_activity_done/i18n/fi.po b/mail_activity_done/i18n/fi.po
new file mode 100644
index 000000000..12f8ea8bf
--- /dev/null
+++ b/mail_activity_done/i18n/fi.po
@@ -0,0 +1,101 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* mail_activity_done
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 16.0\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: 2024-01-22 16:35+0000\n"
+"Last-Translator: Miku Laitinen <github@laitinen.lv>\n"
+"Language-Team: none\n"
+"Language: fi\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_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__active
+msgid "Active"
+msgstr "Aktiivinen"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_bank_statement_line__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_journal__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_move__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_payment__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_setup_bank_manual_config__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mailing_mailing__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_pricelist__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_product__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_template__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner_bank__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids
+msgid "Activities"
+msgstr "Toimenpiteet"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity
+msgid "Activity"
+msgstr "Toimenpide"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity_mixin
+msgid "Activity Mixin"
+msgstr "Toimenpide-mixin"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Completed Activities"
+msgstr "Tehdyt toimenpiteet"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__date_done
+msgid "Completed Date"
+msgstr "Merkattu tehdyksi"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done
+#: model:ir.model.fields.selection,name:mail_activity_done.selection__mail_activity__state__done
+msgid "Done"
+msgstr "Tehty"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Open Activities"
+msgstr "Avoimet toimenpiteet"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state
+msgid "State"
+msgstr "Tila"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_res_users
+msgid "User"
+msgstr "Käyttäjä"
+
+#, python-format
+#~ msgid "%d days overdue"
+#~ msgstr "%d päivää myöhässä"
+
+#, python-format
+#~ msgid "Due in %d days"
+#~ msgstr "Erääntyy %d päivän päästä"
+
+#, python-format
+#~ msgid "Today"
+#~ msgstr "Tänään"
+
+#, python-format
+#~ msgid "Tomorrow"
+#~ msgstr "Huomenna"
+
+#, python-format
+#~ msgid "Yesterday"
+#~ msgstr "Eilen"
diff --git a/mail_activity_done/i18n/fr.po b/mail_activity_done/i18n/fr.po
new file mode 100644
index 000000000..678bc2320
--- /dev/null
+++ b/mail_activity_done/i18n/fr.po
@@ -0,0 +1,101 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* mail_activity_done
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 16.0\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: 2024-03-14 13:29+0000\n"
+"Last-Translator: Houzéfa Abbasbhay <houzefa.abba@xcg-consulting.fr>\n"
+"Language-Team: none\n"
+"Language: fr\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_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__active
+msgid "Active"
+msgstr "Actif"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_bank_statement_line__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_journal__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_move__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_payment__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_setup_bank_manual_config__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mailing_mailing__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_pricelist__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_product__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_template__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner_bank__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids
+msgid "Activities"
+msgstr "Activités"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity
+msgid "Activity"
+msgstr "Activité"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity_mixin
+msgid "Activity Mixin"
+msgstr "Activité - Mixin"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Completed Activities"
+msgstr "Activités réalisées"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__date_done
+msgid "Completed Date"
+msgstr "Date de réalisation"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done
+#: model:ir.model.fields.selection,name:mail_activity_done.selection__mail_activity__state__done
+msgid "Done"
+msgstr "Réalisé"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Open Activities"
+msgstr "Activités ouvertes"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state
+msgid "State"
+msgstr "État"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_res_users
+msgid "User"
+msgstr "Utilisateur"
+
+#, python-format
+#~ msgid "%d days overdue"
+#~ msgstr "%d jours de retard"
+
+#, python-format
+#~ msgid "Due in %d days"
+#~ msgstr "Dû dans %d jours"
+
+#, python-format
+#~ msgid "Today"
+#~ msgstr "Aujourd'hui"
+
+#, python-format
+#~ msgid "Tomorrow"
+#~ msgstr "Demain"
+
+#, python-format
+#~ msgid "Yesterday"
+#~ msgstr "Hier"
diff --git a/mail_activity_done/i18n/hu.po b/mail_activity_done/i18n/hu.po
new file mode 100644
index 000000000..508bc75d5
--- /dev/null
+++ b/mail_activity_done/i18n/hu.po
@@ -0,0 +1,104 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* mail_activity_done
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 13.0\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: 2021-04-16 14:36+0000\n"
+"Last-Translator: Tamás Dombos <tdombos@gmail.com>\n"
+"Language-Team: none\n"
+"Language: hu\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.3.2\n"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__active
+msgid "Active"
+msgstr "Aktív"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_bank_statement_line__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_journal__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_move__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_payment__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_setup_bank_manual_config__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mailing_mailing__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_pricelist__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_product__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_template__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner_bank__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids
+msgid "Activities"
+msgstr "Tevékenységek"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity
+msgid "Activity"
+msgstr "Tevékenység"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity_mixin
+msgid "Activity Mixin"
+msgstr "Tevékenység mixin"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Completed Activities"
+msgstr "Elkészült tevékenységek"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__date_done
+msgid "Completed Date"
+msgstr "Elkészülés dátuma"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done
+#: model:ir.model.fields.selection,name:mail_activity_done.selection__mail_activity__state__done
+msgid "Done"
+msgstr "Kész"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Open Activities"
+msgstr "Nyitott tevékenységek"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state
+msgid "State"
+msgstr "Állapot"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_res_users
+msgid "User"
+msgstr ""
+
+#, python-format
+#~ msgid "%d days overdue"
+#~ msgstr "%d nap késésben"
+
+#, python-format
+#~ msgid "Due in %d days"
+#~ msgstr "%d napon belül esedékes"
+
+#, python-format
+#~ msgid "Today"
+#~ msgstr "Ma"
+
+#, python-format
+#~ msgid "Tomorrow"
+#~ msgstr "Holnap"
+
+#, python-format
+#~ msgid "Yesterday"
+#~ msgstr "Tegnap"
+
+#~ msgid "Users"
+#~ msgstr "Felhasználók"
diff --git a/mail_activity_done/i18n/it.po b/mail_activity_done/i18n/it.po
new file mode 100644
index 000000000..216ba8b57
--- /dev/null
+++ b/mail_activity_done/i18n/it.po
@@ -0,0 +1,101 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* mail_activity_done
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 16.0\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: 2023-12-07 12:35+0000\n"
+"Last-Translator: mymage <stefano.consolaro@mymage.it>\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 4.17\n"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__active
+msgid "Active"
+msgstr "Attiva"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_bank_statement_line__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_journal__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_move__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_payment__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_setup_bank_manual_config__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mailing_mailing__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_pricelist__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_product__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_template__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner_bank__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids
+msgid "Activities"
+msgstr "Attività"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity
+msgid "Activity"
+msgstr "Attività"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity_mixin
+msgid "Activity Mixin"
+msgstr "Mixin attività"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Completed Activities"
+msgstr "Attività completate"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__date_done
+msgid "Completed Date"
+msgstr "Data di completamento"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done
+#: model:ir.model.fields.selection,name:mail_activity_done.selection__mail_activity__state__done
+msgid "Done"
+msgstr "Eseguita"
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Open Activities"
+msgstr "Attività aperte"
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state
+msgid "State"
+msgstr "Stato"
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_res_users
+msgid "User"
+msgstr "Utente"
+
+#, python-format
+#~ msgid "%d days overdue"
+#~ msgstr "%d giorni di ritardo"
+
+#, python-format
+#~ msgid "Due in %d days"
+#~ msgstr "Scade tra %d giorni"
+
+#, python-format
+#~ msgid "Today"
+#~ msgstr "Oggi"
+
+#, python-format
+#~ msgid "Tomorrow"
+#~ msgstr "Domani"
+
+#, python-format
+#~ msgid "Yesterday"
+#~ msgstr "Ieri"
diff --git a/mail_activity_done/i18n/mail_activity_done.pot b/mail_activity_done/i18n/mail_activity_done.pot
new file mode 100644
index 000000000..e1ee3f825
--- /dev/null
+++ b/mail_activity_done/i18n/mail_activity_done.pot
@@ -0,0 +1,78 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* mail_activity_done
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 17.0\n"
+"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_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__active
+msgid "Active"
+msgstr ""
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_bank_statement_line__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_journal__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_move__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_payment__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_account_setup_bank_manual_config__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_mailing_mailing__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_pricelist__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_product__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_product_template__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner_bank__activity_ids
+#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids
+msgid "Activities"
+msgstr ""
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity
+msgid "Activity"
+msgstr ""
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_mail_activity_mixin
+msgid "Activity Mixin"
+msgstr ""
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Completed Activities"
+msgstr ""
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__date_done
+msgid "Completed Date"
+msgstr ""
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done
+#: model:ir.model.fields.selection,name:mail_activity_done.selection__mail_activity__state__done
+msgid "Done"
+msgstr ""
+
+#. module: mail_activity_done
+#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
+msgid "Open Activities"
+msgstr ""
+
+#. module: mail_activity_done
+#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state
+msgid "State"
+msgstr ""
+
+#. module: mail_activity_done
+#: model:ir.model,name:mail_activity_done.model_res_users
+msgid "User"
+msgstr ""
diff --git a/mail_activity_done/migrations/18.0.1.0.0/post-migration.py b/mail_activity_done/migrations/18.0.1.0.0/post-migration.py
new file mode 100644
index 000000000..28a7c1a1e
--- /dev/null
+++ b/mail_activity_done/migrations/18.0.1.0.0/post-migration.py
@@ -0,0 +1,31 @@
+import logging
+
+from odoo.addons.mail_activity_done.hooks import _set_keep_done
+
+
+def migrate(cr, version):
+    """Deal with possible inconsistencies between active and done.
+
+    Set done activities that were not archived to archived.
+    Warn about possible archived activities that were not done.
+    """
+    logger = logging.getLogger("odoo.addons.mail_activity_done.migrations")
+    _set_keep_done(cr)
+    cr.execute(
+        "update mail_activity set active = false where active and done;",
+    )
+    if cr.rowcount:
+        logger.info(
+            f"{cr.rowcount} done activities were previously unarchived. They are "
+            "now set back to archived for Odoo to still consider them done.",
+        )
+    cr.execute(
+        "select id from mail_activity where active is not true and done is not true;",
+    )
+    ids = [str(row[0]) for row in cr.fetchall()]
+    if ids:
+        logger.warning(
+            f"{len(ids)} activities were previously archived but not "
+            "done. Odoo will consider them done now (activities with ids "
+            f"{','.join(ids)})"
+        )
diff --git a/mail_activity_done/models/__init__.py b/mail_activity_done/models/__init__.py
new file mode 100644
index 000000000..d4bcae014
--- /dev/null
+++ b/mail_activity_done/models/__init__.py
@@ -0,0 +1 @@
+from . import mail_activity_type
diff --git a/mail_activity_done/models/mail_activity_type.py b/mail_activity_done/models/mail_activity_type.py
new file mode 100644
index 000000000..31a739978
--- /dev/null
+++ b/mail_activity_done/models/mail_activity_type.py
@@ -0,0 +1,9 @@
+# Copyright 2018-22 ForgeFlow <http://www.forgeflow.com>
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+from odoo import fields, models
+
+
+class MailActivityType(models.Model):
+    _inherit = "mail.activity.type"
+
+    keep_done = fields.Boolean(default=True)
diff --git a/mail_activity_done/pyproject.toml b/mail_activity_done/pyproject.toml
new file mode 100644
index 000000000..4231d0ccc
--- /dev/null
+++ b/mail_activity_done/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["whool"]
+build-backend = "whool.buildapi"
diff --git a/mail_activity_done/readme/CONTRIBUTORS.md b/mail_activity_done/readme/CONTRIBUTORS.md
new file mode 100644
index 000000000..923f96eaf
--- /dev/null
+++ b/mail_activity_done/readme/CONTRIBUTORS.md
@@ -0,0 +1,8 @@
+- Jordi Ballester \<<jordi.ballester@forgeflow.com>\>
+  (www.forgeflow.com)
+- Eduardo Magdalena \<<emagdalena@c2i.es>\> (C2i Change 2 improve
+  <http://www.c2i.es>)
+- Radovan Skolnik \<<radovan@skolnik.info>\> (<https://www.kema.sk>)
+- Manuel Regidor \<<manuel.regidor@sygel.es>\> (<https://www.sygel.es>)
+- Bernat Puig \<<bernat.puig@forgeflow.com>\> (www.forgeflow.com)
+- Stefan Rijnhart \<<stefan@opener.amsterdam>\>
diff --git a/mail_activity_done/readme/DESCRIPTION.md b/mail_activity_done/readme/DESCRIPTION.md
new file mode 100644
index 000000000..8367c5fb3
--- /dev/null
+++ b/mail_activity_done/readme/DESCRIPTION.md
@@ -0,0 +1,7 @@
+This module implements the capability to keep activities that have been
+completed, for future reporting, by setting them with the boolean
+'Done'.
+
+Since Odoo 18.0, this is supported natively by Odoo, depending on the
+configuration of the activity types. This module ensures that the option is
+active on all existing and new activity types in your setup.
diff --git a/mail_activity_done/readme/USAGE.md b/mail_activity_done/readme/USAGE.md
new file mode 100644
index 000000000..5aad00202
--- /dev/null
+++ b/mail_activity_done/readme/USAGE.md
@@ -0,0 +1 @@
+To use this module, you do not need to do anything.
diff --git a/mail_activity_done/static/description/icon.png b/mail_activity_done/static/description/icon.png
new file mode 100644
index 000000000..3a0328b51
Binary files /dev/null and b/mail_activity_done/static/description/icon.png differ
diff --git a/mail_activity_done/static/description/index.html b/mail_activity_done/static/description/index.html
new file mode 100644
index 000000000..cf7b18015
--- /dev/null
+++ b/mail_activity_done/static/description/index.html
@@ -0,0 +1,441 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
+<title>Mail Activity Done</title>
+<style type="text/css">
+
+/*
+:Author: David Goodger (goodger@python.org)
+:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+Despite the name, some widely supported CSS2 features are used.
+
+See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+  border: 0 }
+
+table.borderless td, table.borderless th {
+  /* Override padding for "table.docutils td" with "! important".
+     The right padding separates the table cells. */
+  padding: 0 0.5em 0 0 ! important }
+
+.first {
+  /* Override more specific margin styles with "! important". */
+  margin-top: 0 ! important }
+
+.last, .with-subtitle {
+  margin-bottom: 0 ! important }
+
+.hidden {
+  display: none }
+
+.subscript {
+  vertical-align: sub;
+  font-size: smaller }
+
+.superscript {
+  vertical-align: super;
+  font-size: smaller }
+
+a.toc-backref {
+  text-decoration: none ;
+  color: black }
+
+blockquote.epigraph {
+  margin: 2em 5em ; }
+
+dl.docutils dd {
+  margin-bottom: 0.5em }
+
+object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
+  overflow: hidden;
+}
+
+/* Uncomment (and remove this text!) to get bold-faced definition list terms
+dl.docutils dt {
+  font-weight: bold }
+*/
+
+div.abstract {
+  margin: 2em 5em }
+
+div.abstract p.topic-title {
+  font-weight: bold ;
+  text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+  margin: 2em ;
+  border: medium outset ;
+  padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+  font-weight: bold ;
+  font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title, .code .error {
+  color: red ;
+  font-weight: bold ;
+  font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+   compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+  margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+  margin-top: 0.5em }
+*/
+
+div.dedication {
+  margin: 2em 5em ;
+  text-align: center ;
+  font-style: italic }
+
+div.dedication p.topic-title {
+  font-weight: bold ;
+  font-style: normal }
+
+div.figure {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+div.footer, div.header {
+  clear: both;
+  font-size: smaller }
+
+div.line-block {
+  display: block ;
+  margin-top: 1em ;
+  margin-bottom: 1em }
+
+div.line-block div.line-block {
+  margin-top: 0 ;
+  margin-bottom: 0 ;
+  margin-left: 1.5em }
+
+div.sidebar {
+  margin: 0 0 0.5em 1em ;
+  border: medium outset ;
+  padding: 1em ;
+  background-color: #ffffee ;
+  width: 40% ;
+  float: right ;
+  clear: right }
+
+div.sidebar p.rubric {
+  font-family: sans-serif ;
+  font-size: medium }
+
+div.system-messages {
+  margin: 5em }
+
+div.system-messages h1 {
+  color: red }
+
+div.system-message {
+  border: medium outset ;
+  padding: 1em }
+
+div.system-message p.system-message-title {
+  color: red ;
+  font-weight: bold }
+
+div.topic {
+  margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+  margin-top: 0.4em }
+
+h1.title {
+  text-align: center }
+
+h2.subtitle {
+  text-align: center }
+
+hr.docutils {
+  width: 75% }
+
+img.align-left, .figure.align-left, object.align-left, table.align-left {
+  clear: left ;
+  float: left ;
+  margin-right: 1em }
+
+img.align-right, .figure.align-right, object.align-right, table.align-right {
+  clear: right ;
+  float: right ;
+  margin-left: 1em }
+
+img.align-center, .figure.align-center, object.align-center {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+
+table.align-center {
+  margin-left: auto;
+  margin-right: auto;
+}
+
+.align-left {
+  text-align: left }
+
+.align-center {
+  clear: both ;
+  text-align: center }
+
+.align-right {
+  text-align: right }
+
+/* reset inner alignment in figures */
+div.align-right {
+  text-align: inherit }
+
+/* div.align-center * { */
+/*   text-align: left } */
+
+.align-top    {
+  vertical-align: top }
+
+.align-middle {
+  vertical-align: middle }
+
+.align-bottom {
+  vertical-align: bottom }
+
+ol.simple, ul.simple {
+  margin-bottom: 1em }
+
+ol.arabic {
+  list-style: decimal }
+
+ol.loweralpha {
+  list-style: lower-alpha }
+
+ol.upperalpha {
+  list-style: upper-alpha }
+
+ol.lowerroman {
+  list-style: lower-roman }
+
+ol.upperroman {
+  list-style: upper-roman }
+
+p.attribution {
+  text-align: right ;
+  margin-left: 50% }
+
+p.caption {
+  font-style: italic }
+
+p.credits {
+  font-style: italic ;
+  font-size: smaller }
+
+p.label {
+  white-space: nowrap }
+
+p.rubric {
+  font-weight: bold ;
+  font-size: larger ;
+  color: maroon ;
+  text-align: center }
+
+p.sidebar-title {
+  font-family: sans-serif ;
+  font-weight: bold ;
+  font-size: larger }
+
+p.sidebar-subtitle {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+p.topic-title {
+  font-weight: bold }
+
+pre.address {
+  margin-bottom: 0 ;
+  margin-top: 0 ;
+  font: inherit }
+
+pre.literal-block, pre.doctest-block, pre.math, pre.code {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+pre.code .ln { color: gray; } /* line numbers */
+pre.code, code { background-color: #eeeeee }
+pre.code .comment, code .comment { color: #5C6576 }
+pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
+pre.code .literal.string, code .literal.string { color: #0C5404 }
+pre.code .name.builtin, code .name.builtin { color: #352B84 }
+pre.code .deleted, code .deleted { background-color: #DEB0A1}
+pre.code .inserted, code .inserted { background-color: #A3D289}
+
+span.classifier {
+  font-family: sans-serif ;
+  font-style: oblique }
+
+span.classifier-delimiter {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+span.interpreted {
+  font-family: sans-serif }
+
+span.option {
+  white-space: nowrap }
+
+span.pre {
+  white-space: pre }
+
+span.problematic, pre.problematic {
+  color: red }
+
+span.section-subtitle {
+  /* font-size relative to parent (h1..h6 element) */
+  font-size: 80% }
+
+table.citation {
+  border-left: solid 1px gray;
+  margin-left: 1px }
+
+table.docinfo {
+  margin: 2em 4em }
+
+table.docutils {
+  margin-top: 0.5em ;
+  margin-bottom: 0.5em }
+
+table.footnote {
+  border-left: solid 1px black;
+  margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+  padding-left: 0.5em ;
+  padding-right: 0.5em ;
+  vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+  font-weight: bold ;
+  text-align: left ;
+  white-space: nowrap ;
+  padding-left: 0 }
+
+/* "booktabs" style (no vertical lines) */
+table.docutils.booktabs {
+  border: 0px;
+  border-top: 2px solid;
+  border-bottom: 2px solid;
+  border-collapse: collapse;
+}
+table.docutils.booktabs * {
+  border: 0px;
+}
+table.docutils.booktabs th {
+  border-bottom: thin solid;
+  text-align: left;
+}
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+  font-size: 100% }
+
+ul.auto-toc {
+  list-style-type: none }
+
+</style>
+</head>
+<body>
+<div class="document" id="mail-activity-done">
+<h1 class="title">Mail Activity Done</h1>
+
+<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! This file is generated by oca-gen-addon-readme !!
+!! changes will be overwritten.                   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! source digest: sha256:5a0ce87bede46ee3ef4aca69080182899705bb737283ce6f2e369921f635edf0
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/mail/tree/18.0/mail_activity_done"><img alt="OCA/mail" src="https://img.shields.io/badge/github-OCA%2Fmail-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_activity_done"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/mail&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
+<p>This module implements the capability to keep activities that have been
+completed, for future reporting, by setting them with the boolean
+‘Done’.</p>
+<p>Since Odoo 18.0, this is supported natively by Odoo, depending on the
+configuration of the activity types. This module ensures that the option
+is active on all existing and new activity types in your setup.</p>
+<p><strong>Table of contents</strong></p>
+<div class="contents local topic" id="contents">
+<ul class="simple">
+<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
+<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
+<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
+<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
+<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
+<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
+</ul>
+</li>
+</ul>
+</div>
+<div class="section" id="usage">
+<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
+<p>To use this module, you do not need to do anything.</p>
+</div>
+<div class="section" id="bug-tracker">
+<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
+<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/mail/issues">GitHub Issues</a>.
+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
+<a class="reference external" href="https://github.com/OCA/mail/issues/new?body=module:%20mail_activity_done%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
+<p>Do not contact contributors directly about support or help with technical issues.</p>
+</div>
+<div class="section" id="credits">
+<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
+<div class="section" id="authors">
+<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
+<ul class="simple">
+<li>ForgeFlow</li>
+</ul>
+</div>
+<div class="section" id="contributors">
+<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
+<ul class="simple">
+<li>Jordi Ballester &lt;<a class="reference external" href="mailto:jordi.ballester&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>&gt;
+(<a class="reference external" href="http://www.forgeflow.com">www.forgeflow.com</a>)</li>
+<li>Eduardo Magdalena &lt;<a class="reference external" href="mailto:emagdalena&#64;c2i.es">emagdalena&#64;c2i.es</a>&gt; (C2i Change 2 improve
+<a class="reference external" href="http://www.c2i.es">http://www.c2i.es</a>)</li>
+<li>Radovan Skolnik &lt;<a class="reference external" href="mailto:radovan&#64;skolnik.info">radovan&#64;skolnik.info</a>&gt; (<a class="reference external" href="https://www.kema.sk">https://www.kema.sk</a>)</li>
+<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt; (<a class="reference external" href="https://www.sygel.es">https://www.sygel.es</a>)</li>
+<li>Bernat Puig &lt;<a class="reference external" href="mailto:bernat.puig&#64;forgeflow.com">bernat.puig&#64;forgeflow.com</a>&gt;
+(<a class="reference external" href="http://www.forgeflow.com">www.forgeflow.com</a>)</li>
+<li>Stefan Rijnhart &lt;<a class="reference external" href="mailto:stefan&#64;opener.amsterdam">stefan&#64;opener.amsterdam</a>&gt;</li>
+</ul>
+</div>
+<div class="section" id="maintainers">
+<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
+<p>This module is maintained by the OCA.</p>
+<a class="reference external image-reference" href="https://odoo-community.org">
+<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
+</a>
+<p>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.</p>
+<p>This module is part of the <a class="reference external" href="https://github.com/OCA/mail/tree/18.0/mail_activity_done">OCA/mail</a> project on GitHub.</p>
+<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
+</div>
+</div>
+</div>
+</body>
+</html>
diff --git a/mail_activity_done/tests/__init__.py b/mail_activity_done/tests/__init__.py
new file mode 100644
index 000000000..1f81564cb
--- /dev/null
+++ b/mail_activity_done/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_mail_activity_done
diff --git a/mail_activity_done/tests/test_mail_activity_done.py b/mail_activity_done/tests/test_mail_activity_done.py
new file mode 100644
index 000000000..20b1408f7
--- /dev/null
+++ b/mail_activity_done/tests/test_mail_activity_done.py
@@ -0,0 +1,98 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+import os
+
+from odoo.modules.migration import load_script
+from odoo.tools import mute_logger
+
+from odoo.addons.base.tests.common import BaseCommon
+
+
+class TestMailActivityDone(BaseCommon):
+    @classmethod
+    def setUpClass(cls):
+        super().setUpClass()
+
+    def test_existing_type(self):
+        """The post init hook has enabled keeping done activities on all types"""
+        self.assertTrue(self.env.ref("mail.mail_activity_data_email").keep_done)
+
+    def test_new_type(self):
+        """New activities will be configured to keep done activities by default"""
+        activity_type = self.env["mail.activity.type"].create({"name": __name__})
+        self.assertTrue(activity_type.keep_done)
+
+    def test_migration(self):
+        """The migration script will set keep done for all activity types.
+
+        Also, because in Odoo 18 all archived activities are done, the migration
+        will delete all archived activities that were not done before.
+        """
+
+        # Create two types with a different configuration
+        activity_type1 = self.env["mail.activity.type"].create(
+            {
+                "name": __name__,
+                "keep_done": False,
+            }
+        )
+        self.assertFalse(activity_type1.keep_done)
+
+        activity_type2 = self.env["mail.activity.type"].create({"name": __name__})
+
+        # Create two activities
+        act1 = self.env["mail.activity"].create(
+            {
+                "activity_type_id": activity_type2.id,
+                "res_id": self.env.user.partner_id.id,
+                "res_model": "res.partner",
+                "res_model_id": self.env["ir.model"]._get("res.partner").id,
+                "user_id": self.env.user.id,
+                "date_deadline": "2024-01-01",
+            }
+        )
+        act2 = act1.copy()
+        act3 = act1.copy()
+
+        # Set one activity done
+        act1._action_done()
+        self.assertEqual(act1.state, "done")
+
+        # Set another one as archived
+        act2.active = False
+        # Archived activities are always done, which is not correct in this case
+        self.assertEqual(act2.state, "done")
+        self.env.flush_all()
+
+        # Ressurect the obsolete 'done' column from 17.0 and set it for act1
+        # to distinguish the previously done activity from the mere archived one.
+        self.env.cr.execute(
+            """
+            alter table mail_activity add column done boolean;
+            update mail_activity set done = true where id in %(act_ids)s;
+            """,
+            {"act_ids": (act1.id, act3.id)},
+        )
+        # The third activity is an inconsistent state as it is still active
+        self.assertTrue(act3.active)
+
+        # Run the migration script
+        pyfile = os.path.join(
+            "mail_activity_done",
+            "migrations",
+            "18.0.1.0.0",
+            "post-migration.py",
+        )
+        name, ext = os.path.splitext(os.path.basename(pyfile))
+        mod = load_script(pyfile, name)
+        with mute_logger("odoo.addons.mail_activity_done.migrations"):
+            mod.migrate(self.env.cr, "18.0.1.0.0")
+        self.env.clear()
+
+        # All types are now configured to keep done activities
+        self.assertTrue(activity_type1.keep_done)
+        self.assertTrue(activity_type2.keep_done)
+        self.assertTrue(act1.exists())
+        # Activities that were archived but not done are kept.
+        self.assertTrue(act2.exists())
+        # Activities that were unarchived and done are archived.
+        self.assertFalse(act3.active)


Reviews:
user: login: hbrunn
state: APPROVED
author_association: MEMBER
submitted_at: 2025-02-12T15:14:04Z
user: login: hbrunn
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-02T07:01:27Z
user: login: StefanRijnhart
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-02T08:01:49Z
user: login: hbrunn
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-02T08:17:17Z
user: login: StefanRijnhart
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-02T10:03:16Z
user: login: Ricardoalso
state: APPROVED
author_association: NONE
submitted_at: 2025-05-09T12:47:05Z

Review comments:
diff_hunk: @@ -0,0 +1,11 @@
+from odoo.addons.mail_activity_done.hooks import _set_keep_done
+
+
+def migrate(cr, version):
+    """Set keep_done on all existing activity types"""
+    _set_keep_done(cr)
+    cr.execute(
+        """
+        delete from mail_activity where active is not true and done is not true;
path: mail_activity_done/migrations/18.0.1.0.0/post-migration.py
user: login: hbrunn
body: this one is unexpected for me, what's your rationale here?
created_at: 2025-05-02T07:00:17Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,11 @@
+from odoo.addons.mail_activity_done.hooks import _set_keep_done
+
+
+def migrate(cr, version):
+    """Set keep_done on all existing activity types"""
+    _set_keep_done(cr)
+    cr.execute(
+        """
+        delete from mail_activity where active is not true and done is not true;
path: mail_activity_done/migrations/18.0.1.0.0/post-migration.py
user: login: StefanRijnhart
body: All archived activites are considered done in Odoo 18: https://github.com/odoo/odoo/blob/44e61c6/addons/mail/models/mail_activity.py#L154
created_at: 2025-05-02T08:01:49Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,11 @@
+from odoo.addons.mail_activity_done.hooks import _set_keep_done
+
+
+def migrate(cr, version):
+    """Set keep_done on all existing activity types"""
+    _set_keep_done(cr)
+    cr.execute(
+        """
+        delete from mail_activity where active is not true and done is not true;
path: mail_activity_done/migrations/18.0.1.0.0/post-migration.py
user: login: hbrunn
body: yes but we're migrating the module that people install to keep activities, so I'd not expect its migration to delete anything. I'd expect the migration script to set active to False where done is True (even though the v17 code of this module should have set this in the first place)
created_at: 2025-05-02T08:17:17Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,11 @@
+from odoo.addons.mail_activity_done.hooks import _set_keep_done
+
+
+def migrate(cr, version):
+    """Set keep_done on all existing activity types"""
+    _set_keep_done(cr)
+    cr.execute(
+        """
+        delete from mail_activity where active is not true and done is not true;
path: mail_activity_done/migrations/18.0.1.0.0/post-migration.py
user: login: StefanRijnhart
body: True, handling done activities that are still active is another inconsistency that might need handling. As for the other case, I downgraded that to a warning.
created_at: 2025-05-02T10:03:16Z
author_association: MEMBER

PR comments:
user: login: Bart-dh
created_at: 2025-03-17T16:31:01Z
body: Isn't this default functionality in Odoo 18?
<img width="240" alt="image" src="https://github.com/user-attachments/assets/a45876e8-17c6-4f76-bfb8-aef7485a0e05" />

author_association: NONE
user: login: StefanRijnhart
created_at: 2025-03-17T17:08:34Z
body: @Bart-dh Ooooh, nice find! I'll check if there is remaining functionality to keep, and if migration is required for done activities from earlier versions.
author_association: MEMBER
user: login: StefanRijnhart
created_at: 2025-04-29T18:35:42Z
body: @Bart-dh Thanks again! Indeed, Odoo 18 supports keeping done activities natively. I refactored the module to smoothen out the migration, and to ensure that the activity types in Odoo are always configured to keep done activities.

cc @hbrunn 
author_association: MEMBER
user: login: OCA-git-bot
created_at: 2025-05-09T13:00:02Z
body: This PR has the `approved` label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖
author_association: CONTRIBUTOR
user: login: hbrunn
created_at: 2025-05-09T15:36:59Z
body: /ocabot merge nobump
author_association: MEMBER
user: login: OCA-git-bot
created_at: 2025-05-09T15:37:07Z
body: This PR looks fantastic, let's merge it!
Prepared branch [18.0-ocabot-merge-pr-31-by-hbrunn-bump-nobump](https://github.com/OCA/mail/commits/18.0-ocabot-merge-pr-31-by-hbrunn-bump-nobump), awaiting test results.
author_association: CONTRIBUTOR
user: login: OCA-git-bot
created_at: 2025-05-09T15:42:38Z
body: Congratulations, your PR was merged at 7ec8ce2f0d34a21236e97adc8898d572e16fa699. Thanks a lot for contributing to OCA. ❤️
author_association: CONTRIBUTOR