diff --git a/README.md b/README.md index 53b27cc1b8..fbf062b196 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,12 @@ Available addons ---------------- addon | version | maintainers | summary --- | --- | --- | --- +[mail_activity_cancel_tracking](mail_activity_cancel_tracking/) | 18.0.1.0.0 | victoralmau | Mail Activity Cancel Tracking [mail_activity_unlink_log](mail_activity_unlink_log/) | 18.0.1.0.0 | | Leave a message when an activity is unlinked [mail_gateway](mail_gateway/) | 18.0.1.0.7 | | Base module for gateway communications [mail_gateway_telegram](mail_gateway_telegram/) | 18.0.1.0.0 | | Set a gateway for telegram -[mail_gateway_whatsapp](mail_gateway_whatsapp/) | 18.0.2.0.0 | | Set a gateway for whatsapp +[mail_gateway_telegram_standalone](mail_gateway_telegram_standalone/) | 18.0.1.0.0 | | Generic Telegram API connector +[mail_gateway_whatsapp](mail_gateway_whatsapp/) | 18.0.2.1.2 | | Set a gateway for WhatsApp [mail_notification_with_history](mail_notification_with_history/) | 18.0.1.0.0 | TDu | Add the previous chatter discussion into new email notifications. [mail_thread_create_nolog](mail_thread_create_nolog/) | 18.0.1.0.2 | sebalix | Display a fake (non-stored) create log in the chatter. [res_company_mastodon_link](res_company_mastodon_link/) | 18.0.1.0.0 | legalsylvain | Add mastodon url at company model diff --git a/checklog-odoo.cfg b/checklog-odoo.cfg index 0b55b7bf66..9cc94b30dd 100644 --- a/checklog-odoo.cfg +++ b/checklog-odoo.cfg @@ -1,3 +1,4 @@ [checklog-odoo] ignore= WARNING.* 0 failed, 0 error\(s\).* + WARNING.* Missing widget: res_partner_many2one for field of type many2one.* diff --git a/fetchmail_thread_default/README.rst b/fetchmail_thread_default/README.rst new file mode 100644 index 0000000000..d55dafab56 --- /dev/null +++ b/fetchmail_thread_default/README.rst @@ -0,0 +1,126 @@ +=================================== +Default Thread For Unbounded Emails +=================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:f056776d2194bdb21347c6400e998887bbe47eec12ae15982b0312d7cf3f4148 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-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/18.0/fetchmail_thread_default + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-18-0/social-18-0-fetchmail_thread_default + :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=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of mail fetching to support +choosing a mail thread that acts as a mail sink and gathers all mail +messages that Odoo does not know where to put. + +Dangling emails are really a problem because if you do not care about +them, SPAM can enter your inbox and keep increasing fetchmail process +network quota because Odoo would gather them every time it runs the +fetchmail process. + +Before this, your only choice was to create a new record for those +unbounded emails. That could be useful under some circumstances, like +creating a ``crm.lead`` for them, but what happens if you do not want to +have lots of spammy leads? Or if you do not need Odoo's CRM at all? + +Here we come to the rescue. This simple addons adds almost none +dependencies and allows you to direct those mails somewhere you can +handle or ignore at wish. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +1. Go to *Settings > General Settings > Configure the incoming email + gateway*. + +2. Create or edit a record. + +3. Configure properly. + +4. Under *Default mail thread*, choose a model and record. + + Tip: if you do not know what to choose, we suggest you to use a mail + channel. + +Usage +===== + +To use this module, you need to: + +1. Subscribe to the thread you chose as the *Default mail thread*. +2. You will be notified when a new unbound email lands in that thread. +3. Do what you want with it. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa +* Therp BV + +Contributors +------------ + +- `Tecnativa `__: + + - Jairo Llopis + - David Vidal + +- `Therp BV `__: + + - Giovanni Francesco Capalbo + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/fetchmail_thread_default/__init__.py b/fetchmail_thread_default/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/fetchmail_thread_default/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/fetchmail_thread_default/__manifest__.py b/fetchmail_thread_default/__manifest__.py new file mode 100644 index 0000000000..36dac86078 --- /dev/null +++ b/fetchmail_thread_default/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2017 Tecnativa - Jairo Llopis +# Copyright 2023-24 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Default Thread For Unbounded Emails", + "summary": "Post unkonwn messages to an existing thread", + "version": "18.0.1.0.0", + "category": "Discuss", + "website": "https://github.com/OCA/social", + "author": "Tecnativa, Therp BV, Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": ["mail"], + "data": ["views/fetchmail_server_view.xml"], + "demo": ["demo/data.xml"], +} diff --git a/fetchmail_thread_default/demo/data.xml b/fetchmail_thread_default/demo/data.xml new file mode 100644 index 0000000000..8b1353f319 --- /dev/null +++ b/fetchmail_thread_default/demo/data.xml @@ -0,0 +1,20 @@ + + + + + mailsink + Unbounded email sink + + + + + Demo server + pop + pop3.example.com + + + diff --git a/fetchmail_thread_default/i18n/.empty b/fetchmail_thread_default/i18n/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/fetchmail_thread_default/i18n/ca.po b/fetchmail_thread_default/i18n/ca.po new file mode 100644 index 0000000000..8cccf0bf1e --- /dev/null +++ b/fetchmail_thread_default/i18n/ca.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# Marc Tormo i Bochaca , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2017-06-10 02:46+0000\n" +"Last-Translator: Marc Tormo i Bochaca , 2017\n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" +"Language: ca\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" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "Tema del Correu electrònic " + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" + +#~ msgid "POP/IMAP Server" +#~ msgstr "Servidor POP/IMAP" diff --git a/fetchmail_thread_default/i18n/de.po b/fetchmail_thread_default/i18n/de.po new file mode 100644 index 0000000000..8813198314 --- /dev/null +++ b/fetchmail_thread_default/i18n/de.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# OCA Transbot , 2017 +# Rudolf Schnapka , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2017-06-10 02:46+0000\n" +"Last-Translator: Rudolf Schnapka , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\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" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "Email-Thread" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" + +#~ msgid "POP/IMAP Server" +#~ msgstr "POP/IMAP-Server" diff --git a/fetchmail_thread_default/i18n/es.po b/fetchmail_thread_default/i18n/es.po new file mode 100644 index 0000000000..f82e8fd844 --- /dev/null +++ b/fetchmail_thread_default/i18n/es.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# OCA Transbot , 2017 +# Pedro M. Baeza , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2017-06-10 02:46+0000\n" +"Last-Translator: Pedro M. Baeza , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\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" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "Hilo de mensajes" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" + +#~ msgid "POP/IMAP Server" +#~ msgstr "Servidor POP/IMP" diff --git a/fetchmail_thread_default/i18n/fetchmail_thread_default.pot b/fetchmail_thread_default/i18n/fetchmail_thread_default.pot new file mode 100644 index 0000000000..84b89e5775 --- /dev/null +++ b/fetchmail_thread_default/i18n/fetchmail_thread_default.pot @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" diff --git a/fetchmail_thread_default/i18n/fr.po b/fetchmail_thread_default/i18n/fr.po new file mode 100644 index 0000000000..1a836c6ad9 --- /dev/null +++ b/fetchmail_thread_default/i18n/fr.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# OCA Transbot , 2017 +# Christophe CHAUVET , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2017-06-10 02:46+0000\n" +"Last-Translator: Christophe CHAUVET , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\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" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "Discussion de courriel" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" + +#~ msgid "POP/IMAP Server" +#~ msgstr "Serveur POP/IMAP" diff --git a/fetchmail_thread_default/i18n/hr.po b/fetchmail_thread_default/i18n/hr.po new file mode 100644 index 0000000000..cbe801f901 --- /dev/null +++ b/fetchmail_thread_default/i18n/hr.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# Bole , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2017-06-10 02:46+0000\n" +"Last-Translator: Bole , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" + +#~ msgid "POP/IMAP Server" +#~ msgstr "POP/IMAP Server" diff --git a/fetchmail_thread_default/i18n/it.po b/fetchmail_thread_default/i18n/it.po new file mode 100644 index 0000000000..e0b3442c3d --- /dev/null +++ b/fetchmail_thread_default/i18n/it.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# OCA Transbot , 2017 +# Paolo Valier , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2025-10-15 11:43+0000\n" +"Last-Translator: mymage \n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\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.10.4\n" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "Argomento e-mail predefinito" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "Discussione e-mail" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "Server di posta in arrivo" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" +"Messaggi senza un percorso chiaro verranno inseriti come nuovi messaggi in " +"questo argomento." + +#~ msgid "POP/IMAP Server" +#~ msgstr "Server POP/IMAP" diff --git a/fetchmail_thread_default/i18n/pt_BR.po b/fetchmail_thread_default/i18n/pt_BR.po new file mode 100644 index 0000000000..dae1cfe73d --- /dev/null +++ b/fetchmail_thread_default/i18n/pt_BR.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2024-05-22 14:35+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/" +"23907/pt_BR/)\n" +"Language: pt_BR\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: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "Processo de Email Padrão" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "Processo Email" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "Servidor de Recebimento de Email" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" +"Mensagens sem rota clara serão postadas como uma nova mensagem neste tópico." + +#~ msgid "POP/IMAP Server" +#~ msgstr "Servidor POP/IMAP" diff --git a/fetchmail_thread_default/i18n/pt_PT.po b/fetchmail_thread_default/i18n/pt_PT.po new file mode 100644 index 0000000000..54b766f4ab --- /dev/null +++ b/fetchmail_thread_default/i18n/pt_PT.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2017-06-10 02:46+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Portuguese (Portugal) (https://www.transifex.com/oca/" +"teams/23907/pt_PT/)\n" +"Language: pt_PT\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" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "Tópico de Email" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" diff --git a/fetchmail_thread_default/i18n/sl.po b/fetchmail_thread_default/i18n/sl.po new file mode 100644 index 0000000000..a25ed1d269 --- /dev/null +++ b/fetchmail_thread_default/i18n/sl.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2017-06-10 02:46+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "E-poštni niz" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" + +#~ msgid "POP/IMAP Server" +#~ msgstr "POP/IMAP strežnik" diff --git a/fetchmail_thread_default/i18n/tr.po b/fetchmail_thread_default/i18n/tr.po new file mode 100644 index 0000000000..992e27f4c2 --- /dev/null +++ b/fetchmail_thread_default/i18n/tr.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# OCA Transbot , 2017 +# Ahmet Altinisik , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2017-06-10 02:46+0000\n" +"Last-Translator: Ahmet Altinisik , 2017\n" +"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" +"Language: tr\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" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "Eposta konuşması" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" + +#~ msgid "POP/IMAP Server" +#~ msgstr "POP/IMAP sunucu" diff --git a/fetchmail_thread_default/i18n/zh_CN.po b/fetchmail_thread_default/i18n/zh_CN.po new file mode 100644 index 0000000000..28e8ca55ee --- /dev/null +++ b/fetchmail_thread_default/i18n/zh_CN.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fetchmail_thread_default +# +# Translators: +# Jeffery CHEN , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 02:46+0000\n" +"PO-Revision-Date: 2017-06-10 02:46+0000\n" +"Last-Translator: Jeffery CHEN , 2017\n" +"Language-Team: Chinese (China) (https://www.transifex.com/oca/teams/23907/" +"zh_CN/)\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,field_description:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "Default mail thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model,name:fetchmail_thread_default.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: fetchmail_thread_default +#: model:ir.model.fields,help:fetchmail_thread_default.field_fetchmail_server__default_thread_id +msgid "" +"Messages with no clear route will be posted as a new message to this thread." +msgstr "" + +#~ msgid "POP/IMAP Server" +#~ msgstr "POP/IMAP 服务器" diff --git a/fetchmail_thread_default/models/__init__.py b/fetchmail_thread_default/models/__init__.py new file mode 100644 index 0000000000..670ea5d42c --- /dev/null +++ b/fetchmail_thread_default/models/__init__.py @@ -0,0 +1,2 @@ +from . import fetchmail_server +from . import mail_thread diff --git a/fetchmail_thread_default/models/fetchmail_server.py b/fetchmail_thread_default/models/fetchmail_server.py new file mode 100644 index 0000000000..6345d0adeb --- /dev/null +++ b/fetchmail_thread_default/models/fetchmail_server.py @@ -0,0 +1,48 @@ +# Copyright 2017 Tecnativa - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class FetchmailServer(models.Model): + _inherit = "fetchmail.server" + + default_thread_id = fields.Reference( + selection="_get_thread_models", + string="Default mail thread", + help="Messages with no clear route will be posted as a new message " + "to this thread.", + ) + + @api.model + def _get_thread_models(self): + """Get list of available ``mail.thread`` submodels. + + :return [(model, name), ...]: + Tuple list of available models that can receive messages. + """ + models = ( + self.env["ir.model.fields"] + .sudo() + .search([("name", "=", "message_partner_ids")]) + .mapped("model_id") + ) + # Exclude AbstractModel + return [ + (m.model, m.name) + for m in models + if m.model in self.env and self.env[m.model]._auto + ] + + @api.onchange("server_type", "is_ssl", "object_id") + def onchange_server_type(self): + """Remove :attr:`default_thread_id` if there is :attr:`object_id`.""" + if self.object_id: + self.default_thread_id = False + return super().onchange_server_type() + + @api.onchange("default_thread_id") + def _onchange_remove_object_id(self): + """Remove :attr:`object_id` if there is :attr:`default_thread_id`.""" + if self.default_thread_id: + self.object_id = False diff --git a/fetchmail_thread_default/models/mail_thread.py b/fetchmail_thread_default/models/mail_thread.py new file mode 100644 index 0000000000..146453b1dc --- /dev/null +++ b/fetchmail_thread_default/models/mail_thread.py @@ -0,0 +1,30 @@ +# Copyright 2017 Tecnativa - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class MailThread(models.AbstractModel): + _inherit = "mail.thread" + + @api.model + def message_process( + self, + model, + message, + custom_values=None, + save_original=False, + strip_attachments=False, + thread_id=None, + ): + server = self.env["fetchmail.server"].browse( + self.env.context.get("default_fetchmail_server_id") + ) + if server.default_thread_id and not (model or thread_id): + model = server.default_thread_id._name + thread_id = server.default_thread_id.id + return super( + MailThread, self.with_context(mail_create_nosubscribe=True) + ).message_process( + model, message, custom_values, save_original, strip_attachments, thread_id + ) diff --git a/fetchmail_thread_default/pyproject.toml b/fetchmail_thread_default/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/fetchmail_thread_default/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/fetchmail_thread_default/readme/CONFIGURE.md b/fetchmail_thread_default/readme/CONFIGURE.md new file mode 100644 index 0000000000..e90bad47d9 --- /dev/null +++ b/fetchmail_thread_default/readme/CONFIGURE.md @@ -0,0 +1,13 @@ +To configure this module, you need to: + +1. Go to *Settings \> General Settings \> Configure the incoming email + gateway*. + +2. Create or edit a record. + +3. Configure properly. + +4. Under *Default mail thread*, choose a model and record. + + Tip: if you do not know what to choose, we suggest you to use a mail + channel. diff --git a/fetchmail_thread_default/readme/CONTRIBUTORS.md b/fetchmail_thread_default/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..e2004c3b54 --- /dev/null +++ b/fetchmail_thread_default/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- [Tecnativa](https://www.tecnativa.com): + - Jairo Llopis + - David Vidal +- [Therp BV](https://www.therp.nl): + - Giovanni Francesco Capalbo diff --git a/fetchmail_thread_default/readme/DESCRIPTION.md b/fetchmail_thread_default/readme/DESCRIPTION.md new file mode 100644 index 0000000000..64e3032448 --- /dev/null +++ b/fetchmail_thread_default/readme/DESCRIPTION.md @@ -0,0 +1,17 @@ +This module extends the functionality of mail fetching to support +choosing a mail thread that acts as a mail sink and gathers all mail +messages that Odoo does not know where to put. + +Dangling emails are really a problem because if you do not care about +them, SPAM can enter your inbox and keep increasing fetchmail process +network quota because Odoo would gather them every time it runs the +fetchmail process. + +Before this, your only choice was to create a new record for those +unbounded emails. That could be useful under some circumstances, like +creating a `crm.lead` for them, but what happens if you do not want to +have lots of spammy leads? Or if you do not need Odoo's CRM at all? + +Here we come to the rescue. This simple addons adds almost none +dependencies and allows you to direct those mails somewhere you can +handle or ignore at wish. diff --git a/fetchmail_thread_default/readme/USAGE.md b/fetchmail_thread_default/readme/USAGE.md new file mode 100644 index 0000000000..15dcc529df --- /dev/null +++ b/fetchmail_thread_default/readme/USAGE.md @@ -0,0 +1,5 @@ +To use this module, you need to: + +1. Subscribe to the thread you chose as the *Default mail thread*. +2. You will be notified when a new unbound email lands in that thread. +3. Do what you want with it. diff --git a/fetchmail_thread_default/static/description/icon.png b/fetchmail_thread_default/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/fetchmail_thread_default/static/description/icon.png differ diff --git a/fetchmail_thread_default/static/description/index.html b/fetchmail_thread_default/static/description/index.html new file mode 100644 index 0000000000..31cb4ee604 --- /dev/null +++ b/fetchmail_thread_default/static/description/index.html @@ -0,0 +1,473 @@ + + + + + +Default Thread For Unbounded Emails + + + +
+

Default Thread For Unbounded Emails

+ + +

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

This module extends the functionality of mail fetching to support +choosing a mail thread that acts as a mail sink and gathers all mail +messages that Odoo does not know where to put.

+

Dangling emails are really a problem because if you do not care about +them, SPAM can enter your inbox and keep increasing fetchmail process +network quota because Odoo would gather them every time it runs the +fetchmail process.

+

Before this, your only choice was to create a new record for those +unbounded emails. That could be useful under some circumstances, like +creating a crm.lead for them, but what happens if you do not want to +have lots of spammy leads? Or if you do not need Odoo’s CRM at all?

+

Here we come to the rescue. This simple addons adds almost none +dependencies and allows you to direct those mails somewhere you can +handle or ignore at wish.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Settings > General Settings > Configure the incoming email +gateway.

    +
  2. +
  3. Create or edit a record.

    +
  4. +
  5. Configure properly.

    +
  6. +
  7. Under Default mail thread, choose a model and record.

    +

    Tip: if you do not know what to choose, we suggest you to use a mail +channel.

    +
  8. +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Subscribe to the thread you chose as the Default mail thread.
  2. +
  3. You will be notified when a new unbound email lands in that thread.
  4. +
  5. Do what you want with it.
  6. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
  • Therp BV
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Jairo Llopis
    • +
    • David Vidal
    • +
    +
  • +
  • Therp BV:
      +
    • Giovanni Francesco Capalbo
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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 project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/fetchmail_thread_default/tests/__init__.py b/fetchmail_thread_default/tests/__init__.py new file mode 100644 index 0000000000..6d46f42872 --- /dev/null +++ b/fetchmail_thread_default/tests/__init__.py @@ -0,0 +1 @@ +from . import test_fetchmail diff --git a/fetchmail_thread_default/tests/test_fetchmail.py b/fetchmail_thread_default/tests/test_fetchmail.py new file mode 100644 index 0000000000..2542fa6973 --- /dev/null +++ b/fetchmail_thread_default/tests/test_fetchmail.py @@ -0,0 +1,60 @@ +# Copyright 2017 Tecnativa - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tools import mute_logger + +from odoo.addons.base.tests.common import BaseCommon +from odoo.addons.test_mail.tests.test_mail_gateway import MAIL_TEMPLATE + + +class FetchmailCase(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.server = cls.env.ref("fetchmail_thread_default.demo_server") + cls.sink = cls.env.ref("fetchmail_thread_default.demo_sink") + cls.MailThread = cls.env["mail.thread"] + + def test_available_models(self): + """Non-``mail.thread`` models don't appear.""" + for record in self.server._get_thread_models(): + self.assertNotEqual(record[0], "mail.message") + + def test_emptying_default_thread(self): + """Choosing an ``object_id`` empties ``default_thread_id``.""" + self.server.write({"object_id": 1}) + self.server.onchange_server_type() + self.assertFalse(self.server.default_thread_id) + + def test_emptying_object(self): + """Choosing a ``default_thread_id`` empties ``object_id``.""" + self.server.object_id = self.env["ir.model"].search([], limit=1) + self.server._onchange_remove_object_id() + self.assertFalse(self.server.object_id) + + @mute_logger("odoo.addons.mail.models.mail_thread", "odoo.models") + def test_unbound_incoming_email(self): + """An unbound incoming email gets posted to the sink.""" + # Imitate what self.server.feth_mail() would do + result = self.MailThread.with_context( + default_fetchmail_server_id=self.server.id + ).message_process( + self.server.object_id.model, + MAIL_TEMPLATE.format( + return_path="spambot@example.com", + email_from="spambot@example.com", + to="you@example.com", + cc="nobody@example.com", + subject="I'm a robot, hello", + extra="", + msg_id="", + ), + save_original=self.server.original, + strip_attachments=not self.server.attach, + ) + self.assertEqual(self.server.default_thread_id, self.sink) + self.assertEqual(result, self.sink.id) + # Nobody subscribed + self.assertFalse(self.sink.message_partner_ids) + # Message entered channel + self.assertEqual(self.sink.message_ids.subject, "I'm a robot, hello") diff --git a/fetchmail_thread_default/views/fetchmail_server_view.xml b/fetchmail_thread_default/views/fetchmail_server_view.xml new file mode 100644 index 0000000000..08bed60101 --- /dev/null +++ b/fetchmail_thread_default/views/fetchmail_server_view.xml @@ -0,0 +1,15 @@ + + + + + Add default thread + fetchmail.server + + + + + + + + diff --git a/mail_activity_cancel_tracking/README.rst b/mail_activity_cancel_tracking/README.rst new file mode 100644 index 0000000000..1e26a633c3 --- /dev/null +++ b/mail_activity_cancel_tracking/README.rst @@ -0,0 +1,100 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +============================= +Mail Activity Cancel Tracking +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:a7367877a727cd9cf452de9a5cfc3ea2efa09d60c4d61e7bdf26933467dd65d6 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/18.0/mail_activity_cancel_tracking + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_activity_cancel_tracking + :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=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module leaves a message in the chatter when an activity is +cancelled. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +#. Go to a record that allows to record activities (Contacts for +example). #. Create an activity. #. Click on the "Cancel" button. #. A +message is added in the chatter indicating the details of the activity +that has been canceled. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa + +Contributors +------------ + +- [Tecnativa](https://www.tecnativa.com): + + - Víctor Martínez + - Pedro M. Baeza + +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. + +.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px + :target: https://github.com/victoralmau + :alt: victoralmau + +Current `maintainer `__: + +|maintainer-victoralmau| + +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_activity_cancel_tracking/__init__.py b/mail_activity_cancel_tracking/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/mail_activity_cancel_tracking/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mail_activity_cancel_tracking/__manifest__.py b/mail_activity_cancel_tracking/__manifest__.py new file mode 100644 index 0000000000..6cf7eafd95 --- /dev/null +++ b/mail_activity_cancel_tracking/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2025 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Mail Activity Cancel Tracking", + "author": "Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/social", + "version": "18.0.1.0.0", + "depends": ["mail"], + "license": "AGPL-3", + "category": "Social Network", + "installable": True, + "maintainers": ["victoralmau"], + "data": ["data/mail_template_data.xml"], + "assets": { + "web.assets_tests": [ + "mail_activity_cancel_tracking/static/tests/tours/**/*", + ] + }, +} diff --git a/mail_activity_cancel_tracking/data/mail_template_data.xml b/mail_activity_cancel_tracking/data/mail_template_data.xml new file mode 100644 index 0000000000..0ec2129da7 --- /dev/null +++ b/mail_activity_cancel_tracking/data/mail_template_data.xml @@ -0,0 +1,27 @@ + + + + diff --git a/mail_activity_cancel_tracking/i18n/es.po b/mail_activity_cancel_tracking/i18n/es.po new file mode 100644 index 0000000000..ddd107ec35 --- /dev/null +++ b/mail_activity_cancel_tracking/i18n/es.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_cancel_tracking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-02-18 14:46+0000\n" +"PO-Revision-Date: 2025-02-18 14:46+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mail_activity_cancel_tracking +#: model_terms:ir.ui.view,arch_db:mail_activity_cancel_tracking.message_activity_cancel +msgid "(originally assigned to" +msgstr "" + +#. module: mail_activity_cancel_tracking +#: model_terms:ir.ui.view,arch_db:mail_activity_cancel_tracking.message_activity_cancel +msgid "Original note:" +msgstr "" + +#. module: mail_activity_cancel_tracking +#: model:ir.model,name:mail_activity_cancel_tracking.model_mail_activity +msgid "Activity" +msgstr "Actividad" + +#. module: mail_activity_cancel_tracking +#: model_terms:ir.ui.view,arch_db:mail_activity_cancel_tracking.message_activity_cancel +msgid "canceled" +msgstr "cancelada" diff --git a/mail_activity_cancel_tracking/i18n/it.po b/mail_activity_cancel_tracking/i18n/it.po new file mode 100644 index 0000000000..56ecb60ab8 --- /dev/null +++ b/mail_activity_cancel_tracking/i18n/it.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_cancel_tracking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-02-20 11:06+0000\n" +"Last-Translator: mymage \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_cancel_tracking +#: model_terms:ir.ui.view,arch_db:mail_activity_cancel_tracking.message_activity_cancel +msgid "(originally assigned to" +msgstr "(assegnato originariamente a" + +#. module: mail_activity_cancel_tracking +#: model_terms:ir.ui.view,arch_db:mail_activity_cancel_tracking.message_activity_cancel +msgid "Original note:" +msgstr "Nota origine:" + +#. module: mail_activity_cancel_tracking +#: model:ir.model,name:mail_activity_cancel_tracking.model_mail_activity +msgid "Activity" +msgstr "Attività" + +#. module: mail_activity_cancel_tracking +#: model_terms:ir.ui.view,arch_db:mail_activity_cancel_tracking.message_activity_cancel +msgid "canceled" +msgstr "annullato" diff --git a/mail_activity_cancel_tracking/i18n/mail_activity_cancel_tracking.pot b/mail_activity_cancel_tracking/i18n/mail_activity_cancel_tracking.pot new file mode 100644 index 0000000000..d0ce28e7d5 --- /dev/null +++ b/mail_activity_cancel_tracking/i18n/mail_activity_cancel_tracking.pot @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_cancel_tracking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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_cancel_tracking +#: model_terms:ir.ui.view,arch_db:mail_activity_cancel_tracking.message_activity_cancel +msgid "(originally assigned to" +msgstr "" + +#. module: mail_activity_cancel_tracking +#: model_terms:ir.ui.view,arch_db:mail_activity_cancel_tracking.message_activity_cancel +msgid "Original note:" +msgstr "" + +#. module: mail_activity_cancel_tracking +#: model:ir.model,name:mail_activity_cancel_tracking.model_mail_activity +msgid "Activity" +msgstr "" + +#. module: mail_activity_cancel_tracking +#: model_terms:ir.ui.view,arch_db:mail_activity_cancel_tracking.message_activity_cancel +msgid "canceled" +msgstr "" diff --git a/mail_activity_cancel_tracking/models/__init__.py b/mail_activity_cancel_tracking/models/__init__.py new file mode 100644 index 0000000000..1ff3880296 --- /dev/null +++ b/mail_activity_cancel_tracking/models/__init__.py @@ -0,0 +1 @@ +from . import mail_activity diff --git a/mail_activity_cancel_tracking/models/mail_activity.py b/mail_activity_cancel_tracking/models/mail_activity.py new file mode 100644 index 0000000000..5dc1e6518f --- /dev/null +++ b/mail_activity_cancel_tracking/models/mail_activity.py @@ -0,0 +1,42 @@ +# Copyright 2025 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models + + +class MailActivity(models.Model): + _inherit = "mail.activity" + + def _action_done(self, feedback=False, attachment_ids=None): + """Add the context key to avoid sending the canceled activity email when + marking the activity as done. + """ + self = self.with_context(skip_mail_activity_cancel_log=True) + return super()._action_done(feedback=feedback, attachment_ids=attachment_ids) + + def _log_cancel(self): + """Method for logging a message of subtype "Activities" indicating + that the activities in `self` have been canceled. + """ + for model, activity_data in self._classify_by_model().items(): + records_sudo = self.env[model].sudo().browse(activity_data["record_ids"]) + for record_sudo, activity in zip( + records_sudo, activity_data["activities"], strict=True + ): + # Use exists() to avoid creating messages linked to deleted records + if not record_sudo.exists(): + continue + record_sudo.message_post_with_source( + "mail_activity_cancel_tracking.message_activity_cancel", + author_id=self.env.user.partner_id.id, + render_values={ + "activity": activity, + "display_assignee": activity.user_id != self.env.user, + }, + mail_activity_type_id=activity.activity_type_id.id, + subtype_xmlid="mail.mt_activities", + ) + + def unlink(self): + if not self.env.context.get("skip_mail_activity_cancel_log"): + self._log_cancel() + return super().unlink() diff --git a/mail_activity_cancel_tracking/pyproject.toml b/mail_activity_cancel_tracking/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/mail_activity_cancel_tracking/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_activity_cancel_tracking/readme/CONTRIBUTORS.md b/mail_activity_cancel_tracking/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..1cbf86f11f --- /dev/null +++ b/mail_activity_cancel_tracking/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- \[Tecnativa\](): + - Víctor Martínez + - Pedro M. Baeza diff --git a/mail_activity_cancel_tracking/readme/DESCRIPTION.md b/mail_activity_cancel_tracking/readme/DESCRIPTION.md new file mode 100644 index 0000000000..88bebafba9 --- /dev/null +++ b/mail_activity_cancel_tracking/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module leaves a message in the chatter when an activity is cancelled. diff --git a/mail_activity_cancel_tracking/readme/USAGE.md b/mail_activity_cancel_tracking/readme/USAGE.md new file mode 100644 index 0000000000..7a2bcf3da8 --- /dev/null +++ b/mail_activity_cancel_tracking/readme/USAGE.md @@ -0,0 +1,4 @@ +#. Go to a record that allows to record activities (Contacts for example). +#. Create an activity. +#. Click on the "Cancel" button. +#. A message is added in the chatter indicating the details of the activity that has been canceled. diff --git a/mail_activity_cancel_tracking/static/description/icon.png b/mail_activity_cancel_tracking/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/mail_activity_cancel_tracking/static/description/icon.png differ diff --git a/mail_activity_cancel_tracking/static/description/index.html b/mail_activity_cancel_tracking/static/description/index.html new file mode 100644 index 0000000000..09cfbdabad --- /dev/null +++ b/mail_activity_cancel_tracking/static/description/index.html @@ -0,0 +1,444 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Mail Activity Cancel Tracking

+ +

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

This module leaves a message in the chatter when an activity is +cancelled.

+

Table of contents

+ +
+

Usage

+

#. Go to a record that allows to record activities (Contacts for +example). #. Create an activity. #. Click on the “Cancel” button. #. A +message is added in the chatter indicating the details of the activity +that has been canceled.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

victoralmau

+

This module is part of the OCA/social project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+
+ + diff --git a/mail_activity_cancel_tracking/static/tests/tours/mail_activity_cancel_tracking.esm.js b/mail_activity_cancel_tracking/static/tests/tours/mail_activity_cancel_tracking.esm.js new file mode 100644 index 0000000000..4a437a044d --- /dev/null +++ b/mail_activity_cancel_tracking/static/tests/tours/mail_activity_cancel_tracking.esm.js @@ -0,0 +1,36 @@ +import {registry} from "@web/core/registry"; + +registry.category("web_tour.tours").add("mail_activity_cancel_tracking_done", { + test: true, + steps: () => [ + { + trigger: ".o-mail-Chatter", + }, + { + trigger: "button.o-mail-Activity-markDone", + run: "click", + }, + { + trigger: "button[aria-label='Done']", + run: "click", + }, + { + trigger: ".o-mail-Message:contains('done'):contains('Play Mario Kart')", + }, + ], +}); +registry.category("web_tour.tours").add("mail_activity_cancel_tracking_cancel", { + test: true, + steps: () => [ + { + trigger: ".o-mail-Chatter", + }, + { + trigger: ".o-mail-Activity button.btn-danger:contains('Cancel')", + run: "click", + }, + { + trigger: ".o-mail-Message:contains('canceled'):contains('Play Mario Kart')", + }, + ], +}); diff --git a/mail_activity_cancel_tracking/tests/__init__.py b/mail_activity_cancel_tracking/tests/__init__.py new file mode 100644 index 0000000000..f7c0ac7b42 --- /dev/null +++ b/mail_activity_cancel_tracking/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2025 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_mail_activity_cancel_tracking diff --git a/mail_activity_cancel_tracking/tests/test_mail_activity_cancel_tracking.py b/mail_activity_cancel_tracking/tests/test_mail_activity_cancel_tracking.py new file mode 100644 index 0000000000..7d52a27842 --- /dev/null +++ b/mail_activity_cancel_tracking/tests/test_mail_activity_cancel_tracking.py @@ -0,0 +1,40 @@ +# Copyright 2025 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.tests import new_test_user +from odoo.tests.common import HttpCase, tagged +from odoo.tools import mute_logger + + +@tagged("-at_install", "post_install") +class TestMailActivityCancelTracking(HttpCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env["res.partner"].create({"name": "Test partner"}) + cls.user = new_test_user(cls.env, login="test-user") + cls.mail_activity = cls.partner.activity_schedule( + user_id=cls.user.id, + activity_type_id=cls.env.ref("mail.mail_activity_data_todo").id, + summary="Play Mario Kart", + ) + # Set the user to prevent mail_activity_team from leaving the user empty. + cls.mail_activity.user_id = cls.user + + def test_mail_activity_done(self): + self.start_tour( + f"/web#id={self.partner.id}&model=res.partner", + "mail_activity_cancel_tracking_done", + login="test-user", + ) + + def test_mail_activity_cancel(self): + self.start_tour( + f"/web#id={self.partner.id}&model=res.partner", + "mail_activity_cancel_tracking_cancel", + login="test-user", + ) + + @mute_logger("odoo.models.unlink") + def test_record_unlink(self): + # This process should not fail + self.partner.unlink() diff --git a/mail_gateway_telegram_standalone/README.rst b/mail_gateway_telegram_standalone/README.rst new file mode 100644 index 0000000000..f7b8872136 --- /dev/null +++ b/mail_gateway_telegram_standalone/README.rst @@ -0,0 +1,98 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +=================== +Telegram Standalone +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:34c12609fe829a164efa358bb4f404fe8f76ea6412e1c1d77e8de6b67388f092 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/18.0/mail_gateway_telegram_standalone + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_telegram_standalone + :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=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module provides a generic engine to integrate Telegram Bots with +Odoo. It serves as a foundation for other modules to send notifications, +allowing you to manage bot tokens and authorized chat IDs in a +centralized way. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module: + +1. Go to **Settings > Technical > Email > Gateways**. +2. Create a new Gateway, set the Gateway Type to "Telegram", and enter + the Token provided by @BotFather. +3. Click the **Fetch Chats** button to automatically find Chat IDs of + people who have messaged the bot. +4. Click **Test Connection** to verify that Odoo can communicate with + Telegram. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Anmol Garg + +Contributors +------------ + +- ``Anmol Garg ``\ \_: + + - Anmol Garg + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_gateway_telegram_standalone/__init__.py b/mail_gateway_telegram_standalone/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/mail_gateway_telegram_standalone/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mail_gateway_telegram_standalone/__manifest__.py b/mail_gateway_telegram_standalone/__manifest__.py new file mode 100644 index 0000000000..5d8a900bb3 --- /dev/null +++ b/mail_gateway_telegram_standalone/__manifest__.py @@ -0,0 +1,20 @@ +{ + "name": "Telegram Standalone", + "summary": "Generic Telegram API connector", + "version": "18.0.1.0.0", + "category": "Social", + "author": "Anmol Garg, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/social", + "license": "AGPL-3", + "depends": [ + "base", + "mail", + "mail_gateway_telegram", + ], + "data": [ + "security/ir.model.access.csv", + "views/mail_gateway_views.xml", + ], + "installable": True, + "application": False, +} diff --git a/mail_gateway_telegram_standalone/i18n/it.po b/mail_gateway_telegram_standalone/i18n/it.po new file mode 100644 index 0000000000..b578c550f9 --- /dev/null +++ b/mail_gateway_telegram_standalone/i18n/it.po @@ -0,0 +1,127 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_gateway_telegram_standalone +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-03-31 10:43+0000\n" +"Last-Translator: mymage \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.15.2\n" + +#. module: mail_gateway_telegram_standalone +#. odoo-python +#: code:addons/mail_gateway_telegram_standalone/models/mail_gateway.py:0 +msgid "Success! Connection from Odoo to %s is working." +msgstr "Successo! La connessione da Odoo a %s funziona." + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_mail_gateway__telegram_chat_ids +msgid "Authorized Chats" +msgstr "Discussioni autorizzate" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__chat_id +msgid "Chat" +msgstr "Discussione" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: mail_gateway_telegram_standalone +#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram_standalone.mail_gateway_view_form_inherit_mail_gateway_telegram_standalone +msgid "Fetch Chats" +msgstr "Scarica discussioni" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,help:mail_gateway_telegram_standalone.field_telegram_chat__name +msgid "Friendly name for the chat (e.g. Admin Group)" +msgstr "Nome semplice per la discussione (es. Gruppo amministratori)" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__id +msgid "ID" +msgstr "ID" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model,name:mail_gateway_telegram_standalone.model_mail_gateway +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__gateway_id +msgid "Mail Gateway" +msgstr "Gateway e-mail" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__name +msgid "Name" +msgstr "Nome" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,help:mail_gateway_telegram_standalone.field_telegram_chat__chat_id +msgid "Numeric ID from Telegram" +msgstr "ID numerico per Telegram" + +#. module: mail_gateway_telegram_standalone +#. odoo-python +#: code:addons/mail_gateway_telegram_standalone/models/mail_gateway.py:0 +msgid "Please add or fetch at least one Chat ID first." +msgstr "Prima aggiungere o scaricare almeno un ID discussione." + +#. module: mail_gateway_telegram_standalone +#: model:ir.model,name:mail_gateway_telegram_standalone.model_telegram_chat +msgid "Telegram Chat" +msgstr "Discussione Telegram" + +#. module: mail_gateway_telegram_standalone +#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram_standalone.mail_gateway_view_form_inherit_mail_gateway_telegram_standalone +msgid "Telegram Chats" +msgstr "Discussioni Telegram" + +#. module: mail_gateway_telegram_standalone +#. odoo-python +#: code:addons/mail_gateway_telegram_standalone/models/mail_gateway.py:0 +msgid "" +"Telegram does not allow fetching updates manually while a Webhook is active." +" Please disable the Webhook before using 'Fetch Chats'." +msgstr "" +"Telegram non consente di scaricare manualmente gli aggiornamenti quando un " +"webhook è attivo. Disabilita il webhook prima di utilizzare la funzione " +"\"Scarica chat\"." + +#. module: mail_gateway_telegram_standalone +#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram_standalone.mail_gateway_view_form_inherit_mail_gateway_telegram_standalone +msgid "Test Connection" +msgstr "Prova connessione" + +#. module: mail_gateway_telegram_standalone +#. odoo-python +#: code:addons/mail_gateway_telegram_standalone/models/mail_gateway.py:0 +msgid "Test messages sent!" +msgstr "Messaggi di prova inviati!" diff --git a/mail_gateway_telegram_standalone/i18n/mail_gateway_telegram_standalone.pot b/mail_gateway_telegram_standalone/i18n/mail_gateway_telegram_standalone.pot new file mode 100644 index 0000000000..7845ba2a26 --- /dev/null +++ b/mail_gateway_telegram_standalone/i18n/mail_gateway_telegram_standalone.pot @@ -0,0 +1,121 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_gateway_telegram_standalone +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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_gateway_telegram_standalone +#. odoo-python +#: code:addons/mail_gateway_telegram_standalone/models/mail_gateway.py:0 +msgid "Success! Connection from Odoo to %s is working." +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_mail_gateway__telegram_chat_ids +msgid "Authorized Chats" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__chat_id +msgid "Chat" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__create_uid +msgid "Created by" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__create_date +msgid "Created on" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__display_name +msgid "Display Name" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram_standalone.mail_gateway_view_form_inherit_mail_gateway_telegram_standalone +msgid "Fetch Chats" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,help:mail_gateway_telegram_standalone.field_telegram_chat__name +msgid "Friendly name for the chat (e.g. Admin Group)" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__id +msgid "ID" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__write_date +msgid "Last Updated on" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model,name:mail_gateway_telegram_standalone.model_mail_gateway +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__gateway_id +msgid "Mail Gateway" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,field_description:mail_gateway_telegram_standalone.field_telegram_chat__name +msgid "Name" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model.fields,help:mail_gateway_telegram_standalone.field_telegram_chat__chat_id +msgid "Numeric ID from Telegram" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#. odoo-python +#: code:addons/mail_gateway_telegram_standalone/models/mail_gateway.py:0 +msgid "Please add or fetch at least one Chat ID first." +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model:ir.model,name:mail_gateway_telegram_standalone.model_telegram_chat +msgid "Telegram Chat" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram_standalone.mail_gateway_view_form_inherit_mail_gateway_telegram_standalone +msgid "Telegram Chats" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#. odoo-python +#: code:addons/mail_gateway_telegram_standalone/models/mail_gateway.py:0 +msgid "" +"Telegram does not allow fetching updates manually while a Webhook is active." +" Please disable the Webhook before using 'Fetch Chats'." +msgstr "" + +#. module: mail_gateway_telegram_standalone +#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram_standalone.mail_gateway_view_form_inherit_mail_gateway_telegram_standalone +msgid "Test Connection" +msgstr "" + +#. module: mail_gateway_telegram_standalone +#. odoo-python +#: code:addons/mail_gateway_telegram_standalone/models/mail_gateway.py:0 +msgid "Test messages sent!" +msgstr "" diff --git a/mail_gateway_telegram_standalone/models/__init__.py b/mail_gateway_telegram_standalone/models/__init__.py new file mode 100644 index 0000000000..91b4bfddfb --- /dev/null +++ b/mail_gateway_telegram_standalone/models/__init__.py @@ -0,0 +1,2 @@ +from . import mail_gateway +from . import telegram_chat diff --git a/mail_gateway_telegram_standalone/models/mail_gateway.py b/mail_gateway_telegram_standalone/models/mail_gateway.py new file mode 100644 index 0000000000..2fb395709d --- /dev/null +++ b/mail_gateway_telegram_standalone/models/mail_gateway.py @@ -0,0 +1,109 @@ +import logging + +import requests + +from odoo import _, fields, models +from odoo.exceptions import UserError + +_logger = logging.getLogger(__name__) + + +class MailGateway(models.Model): + _inherit = "mail.gateway" + + telegram_chat_ids = fields.One2many( + "telegram.chat", "gateway_id", string="Authorized Chats" + ) + + def send_message(self, chat_id, message, parse_mode="HTML"): + """Low-level method to send a raw message via Telegram API""" + self.ensure_one() + if self.gateway_type != "telegram": + return False + + url = f"https://api.telegram.org/bot{self.token}/sendMessage" + payload = {"chat_id": chat_id, "text": message, "parse_mode": parse_mode} + try: + with requests.Session() as session: + response = session.post(url, json=payload, timeout=10) + response.raise_for_status() + return True + except Exception as e: + _logger.error("Telegram error for bot %s: %s", self.name, e) + return False + + def action_test_connection(self): + """Button to test connection to all registered simple chats""" + self.ensure_one() + if self.gateway_type != "telegram": + return False + + if not self.telegram_chat_ids: + raise UserError(_("Please add or fetch at least one Chat ID first.")) + + for chat in self.telegram_chat_ids: + msg = ( + _("Success! Connection from Odoo to %s is working.") + % self.name + ) + self.send_message(chat.chat_id, msg) + + return { + "effect": { + "fadeout": "slow", + "message": _("Test messages sent!"), + "type": "rainbow_man", + } + } + + def action_fetch_chats(self): + """Automatically discovers Chat IDs of people who messaged the bot""" + self.ensure_one() + if self.gateway_type != "telegram": + return False + + if self.webhook_key: + raise UserError( + _( + "Telegram does not allow fetching updates manually " + "while a Webhook is active. " + "Please disable the Webhook before using 'Fetch Chats'." + ) + ) + + url = f"https://api.telegram.org/bot{self.token}/getUpdates" + try: + response = requests.get(url, timeout=10) + response.raise_for_status() + data = response.json() + + if not data.get("ok"): + return False + + for result in data.get("result", []): + msg = result.get("message") or result.get("edited_message") + if not msg: + continue + + chat_info = msg.get("chat") + c_id = str(chat_info.get("id")) + c_name = ( + chat_info.get("username") + or chat_info.get("first_name") + or "Unknown" + ) + + if not self.telegram_chat_ids.filtered( + lambda c, c_id=c_id: c.chat_id == c_id + ): + self.env["telegram.chat"].create( + { + "name": c_name, + "chat_id": c_id, + "gateway_id": self.id, + } + ) + return True + except Exception as e: + _logger.error("Fetch failed: %s", e) + return False diff --git a/mail_gateway_telegram_standalone/models/telegram_chat.py b/mail_gateway_telegram_standalone/models/telegram_chat.py new file mode 100644 index 0000000000..2add70ddce --- /dev/null +++ b/mail_gateway_telegram_standalone/models/telegram_chat.py @@ -0,0 +1,14 @@ +from odoo import fields, models + + +class TelegramChat(models.Model): + _name = "telegram.chat" + _description = "Telegram Chat" + + name = fields.Char( + required=True, help="Friendly name for the chat (e.g. Admin Group)" + ) + chat_id = fields.Char(required=True, help="Numeric ID from Telegram") + gateway_id = fields.Many2one( + "mail.gateway", ondelete="cascade", string="Mail Gateway" + ) diff --git a/mail_gateway_telegram_standalone/pyproject.toml b/mail_gateway_telegram_standalone/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/mail_gateway_telegram_standalone/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_gateway_telegram_standalone/readme/CONTRIBUTORS.md b/mail_gateway_telegram_standalone/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..0e605955c7 --- /dev/null +++ b/mail_gateway_telegram_standalone/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +* `Anmol Garg `_: + * Anmol Garg \ No newline at end of file diff --git a/mail_gateway_telegram_standalone/readme/DESCRIPTION.md b/mail_gateway_telegram_standalone/readme/DESCRIPTION.md new file mode 100644 index 0000000000..8b1ae30752 --- /dev/null +++ b/mail_gateway_telegram_standalone/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module provides a generic engine to integrate Telegram Bots with Odoo. +It serves as a foundation for other modules to send notifications, +allowing you to manage bot tokens and authorized chat IDs in a centralized way. \ No newline at end of file diff --git a/mail_gateway_telegram_standalone/readme/USAGE.md b/mail_gateway_telegram_standalone/readme/USAGE.md new file mode 100644 index 0000000000..2c26d10e90 --- /dev/null +++ b/mail_gateway_telegram_standalone/readme/USAGE.md @@ -0,0 +1,6 @@ +To use this module: + +1. Go to **Settings > Technical > Email > Gateways**. +2. Create a new Gateway, set the Gateway Type to "Telegram", and enter the Token provided by @BotFather. +3. Click the **Fetch Chats** button to automatically find Chat IDs of people who have messaged the bot. +4. Click **Test Connection** to verify that Odoo can communicate with Telegram. \ No newline at end of file diff --git a/mail_gateway_telegram_standalone/security/ir.model.access.csv b/mail_gateway_telegram_standalone/security/ir.model.access.csv new file mode 100644 index 0000000000..ea68ed746f --- /dev/null +++ b/mail_gateway_telegram_standalone/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_telegram_chat_admin,telegram.chat.admin,model_telegram_chat,base.group_system,1,1,1,1 diff --git a/mail_gateway_telegram_standalone/static/description/icon.png b/mail_gateway_telegram_standalone/static/description/icon.png new file mode 100644 index 0000000000..1dcc49c24f Binary files /dev/null and b/mail_gateway_telegram_standalone/static/description/icon.png differ diff --git a/mail_gateway_telegram_standalone/static/description/index.html b/mail_gateway_telegram_standalone/static/description/index.html new file mode 100644 index 0000000000..12bb423003 --- /dev/null +++ b/mail_gateway_telegram_standalone/static/description/index.html @@ -0,0 +1,449 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Telegram Standalone

+ +

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

This module provides a generic engine to integrate Telegram Bots with +Odoo. It serves as a foundation for other modules to send notifications, +allowing you to manage bot tokens and authorized chat IDs in a +centralized way.

+

Table of contents

+ +
+

Usage

+

To use this module:

+
    +
  1. Go to Settings > Technical > Email > Gateways.
  2. +
  3. Create a new Gateway, set the Gateway Type to “Telegram”, and enter +the Token provided by @BotFather.
  4. +
  5. Click the Fetch Chats button to automatically find Chat IDs of +people who have messaged the bot.
  6. +
  7. Click Test Connection to verify that Odoo can communicate with +Telegram.
  8. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Anmol Garg
  • +
+
+
+

Contributors

+
    +
  • Anmol Garg <https://github.com/AnmollGarg>_:
      +
    • Anmol Garg
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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 project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+
+ + diff --git a/mail_gateway_telegram_standalone/tests/__init__.py b/mail_gateway_telegram_standalone/tests/__init__.py new file mode 100644 index 0000000000..90ba732b64 --- /dev/null +++ b/mail_gateway_telegram_standalone/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mail_gateway_telegram_standalone diff --git a/mail_gateway_telegram_standalone/tests/test_mail_gateway_telegram_standalone.py b/mail_gateway_telegram_standalone/tests/test_mail_gateway_telegram_standalone.py new file mode 100644 index 0000000000..093dec4058 --- /dev/null +++ b/mail_gateway_telegram_standalone/tests/test_mail_gateway_telegram_standalone.py @@ -0,0 +1,137 @@ +# Copyright 2026 Anmol Garg +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from unittest.mock import patch + +import requests + +from odoo.exceptions import UserError +from odoo.tests.common import TransactionCase +from odoo.tools import mute_logger + + +class TestTelegramBot(TransactionCase): + def setUp(self): + super().setUp() + # Create a test bot + self.bot = self.env["mail.gateway"].create( + { + "name": "Test Bot", + "gateway_type": "telegram", + "token": "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11", + } + ) + # Create a test chat linked to the bot + self.chat = self.env["telegram.chat"].create( + { + "name": "Test Chat", + "chat_id": "1856618864", + "gateway_id": self.bot.id, + } + ) + + @patch("requests.Session.post") + def test_send_message_success(self, mock_post): + """Test a successful message delivery""" + # Mock a successful 200 response + mock_post.return_value.status_code = 200 + mock_post.return_value.raise_for_status = lambda: None + + result = self.bot.send_message(self.chat.chat_id, "Hello from Odoo Test") + + self.assertTrue(result, "The send_message method should return True on success") + self.assertEqual( + mock_post.call_count, 1, "Exactly one POST request should be made" + ) + + def test_action_test_connection_no_chats(self): + """Test action_test_connection raises UserError when no chats""" + self.bot.telegram_chat_ids = [(5, 0, 0)] # Clear chats + with self.assertRaises(UserError): + self.bot.action_test_connection() + + @patch("requests.Session.post") + def test_action_test_connection_success(self, mock_post): + """Test action_test_connection sends messages to all chats""" + mock_post.return_value.status_code = 200 + mock_post.return_value.raise_for_status = lambda: None + + res = self.bot.action_test_connection() + + self.assertEqual(mock_post.call_count, 1) + self.assertEqual(res.get("effect", {}).get("type"), "rainbow_man") + + @mute_logger("odoo.addons.mail_gateway_telegram_standalone.models.mail_gateway") + @patch("requests.Session.post") + def test_send_message_failure(self, mock_post): + """Test handling of a connection failure""" + # Simulate a real exception (like a timeout or DNS error) + # This will trigger the 'except' block in your telegram_bot.py + mock_post.side_effect = requests.exceptions.RequestException( + "Connection Failed" + ) + + result = self.bot.send_message(self.chat.chat_id, "This should fail") + + # This should now correctly return False + self.assertFalse( + result, "The send_message method should return False on exception" + ) + + @patch("requests.get") + def test_action_fetch_chats(self, mock_get): + """Test fetching chats from Telegram API""" + # Mock the JSON response from Telegram /getUpdates + mock_get.return_value.status_code = 200 + mock_get.return_value.json.return_value = { + "ok": True, + "result": [ + { + "update_id": 1, + "message": { + "chat": { + "id": 111222, + "first_name": "NewUser", + "type": "private", + }, + "text": "hi", + }, + } + ], + } + + self.bot.action_fetch_chats() + + # Verify a new chat was created in Odoo + new_chat = self.env["telegram.chat"].search([("chat_id", "=", "111222")]) + self.assertTrue( + new_chat, "A new chat should have been created from the mock data" + ) + self.assertEqual(new_chat.name, "NewUser") + + @patch("requests.get") + def test_action_fetch_chats_error(self, mock_get): + """Test action_fetch_chats handles ok: False""" + mock_get.return_value.status_code = 200 + mock_get.return_value.json.return_value = {"ok": False} + result = self.bot.action_fetch_chats() + self.assertFalse(result) + + @patch("requests.get") + def test_action_fetch_chats_empty_message(self, mock_get): + """Test action_fetch_chats handles result without message""" + mock_get.return_value.status_code = 200 + mock_get.return_value.json.return_value = { + "ok": True, + "result": [{"update_id": 1}], # No message key + } + result = self.bot.action_fetch_chats() + self.assertTrue(result) + + @mute_logger("odoo.addons.mail_gateway_telegram_standalone.models.mail_gateway") + @patch("requests.get") + def test_action_fetch_chats_exception(self, mock_get): + """Test action_fetch_chats handles exceptions""" + mock_get.side_effect = requests.exceptions.RequestException("API Down") + result = self.bot.action_fetch_chats() + self.assertFalse(result) diff --git a/mail_gateway_telegram_standalone/views/mail_gateway_views.xml b/mail_gateway_telegram_standalone/views/mail_gateway_views.xml new file mode 100644 index 0000000000..2597b8dde2 --- /dev/null +++ b/mail_gateway_telegram_standalone/views/mail_gateway_views.xml @@ -0,0 +1,47 @@ + + + + mail.gateway.view.form.inherit.mail.gateway.telegram.standalone + mail.gateway + + + + +