diff --git a/mail_attach_existing_attachment/README.rst b/mail_attach_existing_attachment/README.rst new file mode 100644 index 000000000..d2a9ee2a1 --- /dev/null +++ b/mail_attach_existing_attachment/README.rst @@ -0,0 +1,119 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +=============================== +Mail Attach Existing Attachment +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:578cfdefd4d461e90fdf1d9de67f86992efeaf51c556f4be4da72a920740e881 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fmail-lightgray.png?logo=github + :target: https://github.com/OCA/mail/tree/19.0/mail_attach_existing_attachment + :alt: OCA/mail +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/mail-19-0/mail-19-0-mail_attach_existing_attachment + :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=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module was written to add the possibility to add attachments +located on the object by sending it by email with the mail compose +message wizard + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +- Add some attachments on an object by creating a new *Log note* + +|image1| + +- Then, by sending the object via email, you can select the attachment + added earlier + +|image2| + +.. |image1| image:: https://raw.githubusercontent.com/OCA/mail/19.0/mail_attach_existing_attachment/static/description/attachment.png +.. |image2| image:: https://raw.githubusercontent.com/OCA/mail/19.0/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png + +Known issues / Roadmap +====================== + +- The module only allows the addition of attachments linked to the + object. + +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 +------- + +* ACSONE SA/NV +* Tecnativa + +Contributors +------------ + +- Adrien Peiffer +- Benoit Aimont +- `Tecnativa `__: + + - Sergio Teruel + - Ernesto Tejeda + +- `360ERP `__: + + - Andrea Stirpe + +- `Apik `__: + + - Frederic Grall + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_attach_existing_attachment/__init__.py b/mail_attach_existing_attachment/__init__.py new file mode 100644 index 000000000..40272379f --- /dev/null +++ b/mail_attach_existing_attachment/__init__.py @@ -0,0 +1 @@ +from . import wizard diff --git a/mail_attach_existing_attachment/__manifest__.py b/mail_attach_existing_attachment/__manifest__.py new file mode 100644 index 000000000..8066499ba --- /dev/null +++ b/mail_attach_existing_attachment/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2015 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Mail Attach Existing Attachment", + "summary": "Adding attachment on the object by sending this one", + "author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/mail", + "category": "Social Network", + "version": "19.0.1.0.0", + "license": "AGPL-3", + "depends": ["mail"], + "data": ["wizard/mail_compose_message_view.xml"], + "installable": True, +} diff --git a/mail_attach_existing_attachment/i18n/ca.po b/mail_attach_existing_attachment/i18n/ca.po new file mode 100644 index 000000000..129509786 --- /dev/null +++ b/mail_attach_existing_attachment/i18n/ca.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-13 02:44+0000\n" +"PO-Revision-Date: 2016-06-12 23:57+0000\n" +"Last-Translator: <>\n" +"Language-Team: Catalan (http://www.transifex.com/oca/OCA-social-9-0/language/" +"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: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistent per composició de correus electrònics" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +msgid "Object Attachments" +msgstr "" diff --git a/mail_attach_existing_attachment/i18n/de.po b/mail_attach_existing_attachment/i18n/de.po new file mode 100644 index 000000000..62cd915bb --- /dev/null +++ b/mail_attach_existing_attachment/i18n/de.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +# OCA Transbot , 2016 +# Niki Waibel , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-29 14:24+0000\n" +"PO-Revision-Date: 2016-11-29 14:24+0000\n" +"Last-Translator: Niki Waibel , 2016\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: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "Kann Anhang anhängen" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistent zum Email verfassen" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +#, fuzzy +msgid "Object Attachments" +msgstr "Anhänge" diff --git a/mail_attach_existing_attachment/i18n/es.po b/mail_attach_existing_attachment/i18n/es.po new file mode 100644 index 000000000..23b9543fe --- /dev/null +++ b/mail_attach_existing_attachment/i18n/es.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +# OCA Transbot , 2017 +# Pedro M. Baeza , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:19+0000\n" +"PO-Revision-Date: 2023-09-03 13:36+0000\n" +"Last-Translator: Ivorra78 \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" +"X-Generator: Weblate 4.17\n" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "Puede adjuntar adjuntos" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Asistente composición Correo Electrónico" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +msgid "Object Attachments" +msgstr "Archivos adjuntos de objetos" diff --git a/mail_attach_existing_attachment/i18n/es_CO.po b/mail_attach_existing_attachment/i18n/es_CO.po new file mode 100644 index 000000000..fb5bd09b8 --- /dev/null +++ b/mail_attach_existing_attachment/i18n/es_CO.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-13 02:44+0000\n" +"PO-Revision-Date: 2016-06-12 23:57+0000\n" +"Last-Translator: <>\n" +"Language-Team: Spanish (Colombia) (http://www.transifex.com/oca/OCA-" +"social-9-0/language/es_CO/)\n" +"Language: es_CO\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: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Asistente de redacción de E-mail" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +msgid "Object Attachments" +msgstr "" diff --git a/mail_attach_existing_attachment/i18n/fr.po b/mail_attach_existing_attachment/i18n/fr.po new file mode 100644 index 000000000..428f66dfd --- /dev/null +++ b/mail_attach_existing_attachment/i18n/fr.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +# OCA Transbot , 2016 +# Quentin THEURET , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-22 09:45+0000\n" +"PO-Revision-Date: 2017-07-22 09:45+0000\n" +"Last-Translator: Quentin THEURET , 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: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "Il est possible d'attacher des pièces jointes" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistant de composition de courriel" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +#, fuzzy +msgid "Object Attachments" +msgstr "Pièces jointes" diff --git a/mail_attach_existing_attachment/i18n/he.po b/mail_attach_existing_attachment/i18n/he.po new file mode 100644 index 000000000..d3c265b65 --- /dev/null +++ b/mail_attach_existing_attachment/i18n/he.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-10-19 08:08+0000\n" +"Last-Translator: Yves Goldberg \n" +"Language-Team: none\n" +"Language: he\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n == 1) ? 0 : ((n == 2) ? 1 : ((n > 10 && " +"n % 10 == 0) ? 2 : 3));\n" +"X-Generator: Weblate 3.10\n" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "ניתן לצרף קובץ מצורף" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "אשף יצירת דואר אלקטרוני" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +msgid "Object Attachments" +msgstr "קבצים מצורפים לאובייקט" diff --git a/mail_attach_existing_attachment/i18n/hr.po b/mail_attach_existing_attachment/i18n/hr.po new file mode 100644 index 000000000..b07a723e1 --- /dev/null +++ b/mail_attach_existing_attachment/i18n/hr.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +# Bole , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-13 02:44+0000\n" +"PO-Revision-Date: 2016-06-14 11:29+0000\n" +"Last-Translator: Bole \n" +"Language-Team: Croatian (http://www.transifex.com/oca/OCA-social-9-0/" +"language/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: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "Može pridružiti privitak" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Čarobnjak za sastavljanje maila" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +#, fuzzy +msgid "Object Attachments" +msgstr "Privitci" diff --git a/mail_attach_existing_attachment/i18n/it.po b/mail_attach_existing_attachment/i18n/it.po new file mode 100644 index 000000000..95ca26cad --- /dev/null +++ b/mail_attach_existing_attachment/i18n/it.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +# OCA Transbot , 2016 +# Marius Marolla , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-17 01:02+0000\n" +"PO-Revision-Date: 2024-11-12 20:06+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.6.2\n" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "Può inserire allegati" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "Visualizza allegato oggetto" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Procedura guidata creazione e-mail" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +msgid "Object Attachments" +msgstr "Allegati oggetto" diff --git a/mail_attach_existing_attachment/i18n/mail_attach_existing_attachment.pot b/mail_attach_existing_attachment/i18n/mail_attach_existing_attachment.pot new file mode 100644 index 000000000..992444ba0 --- /dev/null +++ b/mail_attach_existing_attachment/i18n/mail_attach_existing_attachment.pot @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +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_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +msgid "Object Attachments" +msgstr "" diff --git a/mail_attach_existing_attachment/i18n/pt_BR.po b/mail_attach_existing_attachment/i18n/pt_BR.po new file mode 100644 index 000000000..497ae45c4 --- /dev/null +++ b/mail_attach_existing_attachment/i18n/pt_BR.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +# Armando Vulcano Junior , 2015 +msgid "" +msgstr "" +"Project-Id-Version: social (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-13 02:44+0000\n" +"PO-Revision-Date: 2019-08-26 16:01+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-" +"social-9-0/language/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 3.8\n" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "Pode Anexar Anexo" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistente de Composição de Email" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +msgid "Object Attachments" +msgstr "Anexos de Objeto" diff --git a/mail_attach_existing_attachment/i18n/sl.po b/mail_attach_existing_attachment/i18n/sl.po new file mode 100644 index 000000000..038e55395 --- /dev/null +++ b/mail_attach_existing_attachment/i18n/sl.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +# Matjaž Mozetič , 2015 +msgid "" +msgstr "" +"Project-Id-Version: social (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-13 02:44+0000\n" +"PO-Revision-Date: 2020-03-19 10:13+0000\n" +"Last-Translator: Matjaz Mozetic \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-social-9-0/" +"language/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" +"X-Generator: Weblate 3.10\n" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "Lahko pripenja priponke" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Čarovnik za sestavljanje e-pošte" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +msgid "Object Attachments" +msgstr "Priponke objekta" diff --git a/mail_attach_existing_attachment/i18n/zh_CN.po b/mail_attach_existing_attachment/i18n/zh_CN.po new file mode 100644 index 000000000..14f9c0189 --- /dev/null +++ b/mail_attach_existing_attachment/i18n/zh_CN.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment +# +# Translators: +# Jeffery Chenn , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-09-02 00:46+0000\n" +"PO-Revision-Date: 2016-09-04 05:54+0000\n" +"Last-Translator: Jeffery Chenn \n" +"Language-Team: Chinese (China) (http://www.transifex.com/oca/OCA-social-9-0/" +"language/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: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message +msgid "Email composition wizard" +msgstr "" + +#. module: mail_attach_existing_attachment +#: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids +#, fuzzy +msgid "Object Attachments" +msgstr "附件" diff --git a/mail_attach_existing_attachment/pyproject.toml b/mail_attach_existing_attachment/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/mail_attach_existing_attachment/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_attach_existing_attachment/readme/CONTRIBUTORS.md b/mail_attach_existing_attachment/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..74bed8a74 --- /dev/null +++ b/mail_attach_existing_attachment/readme/CONTRIBUTORS.md @@ -0,0 +1,9 @@ +- Adrien Peiffer \<\> +- Benoit Aimont \<\> +- [Tecnativa](https://www.tecnativa.com): + - Sergio Teruel + - Ernesto Tejeda +- [360ERP](https://www.360erp.com): + - Andrea Stirpe +- [Apik](https://www.aapik.cloud): + - Frederic Grall diff --git a/mail_attach_existing_attachment/readme/DESCRIPTION.md b/mail_attach_existing_attachment/readme/DESCRIPTION.md new file mode 100644 index 000000000..8f21687eb --- /dev/null +++ b/mail_attach_existing_attachment/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module was written to add the possibility to add attachments +located on the object by sending it by email with the mail compose +message wizard diff --git a/mail_attach_existing_attachment/readme/ROADMAP.md b/mail_attach_existing_attachment/readme/ROADMAP.md new file mode 100644 index 000000000..7182847cf --- /dev/null +++ b/mail_attach_existing_attachment/readme/ROADMAP.md @@ -0,0 +1,2 @@ +- The module only allows the addition of attachments linked to the + object. diff --git a/mail_attach_existing_attachment/readme/USAGE.md b/mail_attach_existing_attachment/readme/USAGE.md new file mode 100644 index 000000000..b1bdedd95 --- /dev/null +++ b/mail_attach_existing_attachment/readme/USAGE.md @@ -0,0 +1,10 @@ +To use this module, you need to: + +- Add some attachments on an object by creating a new *Log note* + +![](../static/description/attachment.png) + +- Then, by sending the object via email, you can select the attachment + added earlier + +![](../static/description/ex_mail_compose_message.png) diff --git a/mail_attach_existing_attachment/static/description/attachment.png b/mail_attach_existing_attachment/static/description/attachment.png new file mode 100644 index 000000000..0a6c2c23b Binary files /dev/null and b/mail_attach_existing_attachment/static/description/attachment.png differ diff --git a/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png b/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png new file mode 100644 index 000000000..c6437475a Binary files /dev/null and b/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png differ diff --git a/mail_attach_existing_attachment/static/description/icon.png b/mail_attach_existing_attachment/static/description/icon.png new file mode 100644 index 000000000..0b6c4d895 Binary files /dev/null and b/mail_attach_existing_attachment/static/description/icon.png differ diff --git a/mail_attach_existing_attachment/static/description/index.html b/mail_attach_existing_attachment/static/description/index.html new file mode 100644 index 000000000..59511eba3 --- /dev/null +++ b/mail_attach_existing_attachment/static/description/index.html @@ -0,0 +1,468 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Mail Attach Existing Attachment

+ +

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

+

This module was written to add the possibility to add attachments +located on the object by sending it by email with the mail compose +message wizard

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  • Add some attachments on an object by creating a new Log note
  • +
+

image1

+
    +
  • Then, by sending the object via email, you can select the attachment +added earlier
  • +
+

image2

+
+
+

Known issues / Roadmap

+
    +
  • The module only allows the addition of attachments linked to the +object.
  • +
+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
  • 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.

+

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

+

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

+
+
+
+
+ + diff --git a/mail_attach_existing_attachment/tests/__init__.py b/mail_attach_existing_attachment/tests/__init__.py new file mode 100644 index 000000000..01f264cc1 --- /dev/null +++ b/mail_attach_existing_attachment/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mail_attach_existing_attachment diff --git a/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py b/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py new file mode 100644 index 000000000..5e3fd4812 --- /dev/null +++ b/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py @@ -0,0 +1,90 @@ +# Copyright 2015 ACSONE SA/NV +# Copyright 2024 360ERP () +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests import Form, TransactionCase + + +class TestMailComposer(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner_01 = cls.env["res.partner"].create( + { + "name": "Partner 1", + "email": "partner1@example.org", + "is_company": True, + "parent_id": False, + } + ) + cls.attach1 = cls.env["ir.attachment"].create( + { + "name": "Attach1", + "datas": "bWlncmF0aW9uIHRlc3Q=", + "res_model": "res.partner", + "res_id": cls.partner_01.id, + } + ) + + def test_01_send_email_attachment(self): + """Test sending amail with attachment from Object Attachment of composer""" + # Open email composer + composer_form = Form( + self.env["mail.compose.message"].with_context( + default_composition_mode="comment", + default_model=self.partner_01._name, + default_res_ids=self.partner_01.ids, + ) + ) + + # Field can_attach_attachment is automatically set + self.assertTrue(composer_form.can_attach_attachment) + + # By default, no attachments are present + self.assertFalse(composer_form.partner_ids[:]) + self.assertEqual(len(composer_form.attachment_ids), 0) + self.assertEqual(len(composer_form.object_attachment_ids), 0) + + # One selectable Object Attachment is displayed + display_records = composer_form.display_object_attachment_ids._records + self.assertEqual(len(display_records), 1) + self.assertEqual(display_records[0]["id"], self.attach1.id) + + # Fill email composer with the Object Attachment + composer_form.partner_ids = self.partner_01 + composer_form.object_attachment_ids = self.attach1 + mail = composer_form.save() + + # Send email: the attachment is sent + values = mail._action_send_mail() + result_message = values[1] + self.assertEqual(result_message.attachment_ids, self.attach1) + + def test_02_prepare_mail_values(self): + """Test method _prepare_mail_values()""" + attach2 = self.attach1.copy() + # Create email composer with 2 Object Attachments + composer = ( + self.env["mail.compose.message"] + .with_context( + default_composition_mode="comment", + default_model=self.partner_01._name, + default_res_ids=self.partner_01.ids, + ) + .create( + { + "object_attachment_ids": (self.attach1 + attach2).ids, + } + ) + ) + + # Two selectable Object Attachments are displayed + display_records = composer.display_object_attachment_ids + self.assertEqual(len(display_records), 2) + self.assertIn(self.attach1, display_records) + self.assertIn(attach2, display_records) + + # Invoking _prepare_mail_values(): both attachment_ids are set + values = composer._prepare_mail_values(self.partner_01.ids) + self.assertIn(self.attach1.id, values[self.partner_01.id]["attachment_ids"]) + self.assertIn(attach2.id, values[self.partner_01.id]["attachment_ids"]) diff --git a/mail_attach_existing_attachment/wizard/__init__.py b/mail_attach_existing_attachment/wizard/__init__.py new file mode 100644 index 000000000..b528d997d --- /dev/null +++ b/mail_attach_existing_attachment/wizard/__init__.py @@ -0,0 +1 @@ +from . import mail_compose_message diff --git a/mail_attach_existing_attachment/wizard/mail_compose_message.py b/mail_attach_existing_attachment/wizard/mail_compose_message.py new file mode 100644 index 000000000..205893ff9 --- /dev/null +++ b/mail_attach_existing_attachment/wizard/mail_compose_message.py @@ -0,0 +1,57 @@ +# Copyright 2015 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class MailComposeMessage(models.TransientModel): + _inherit = "mail.compose.message" + + @api.model + def default_get(self, fields_list): + res = super().default_get(fields_list) + if ( + "can_attach_attachment" not in res + and res.get("model") + and res.get("res_ids") + and res.get("composition_mode", "") != "mass_mail" + ): + res["can_attach_attachment"] = True # pragma: no cover + return res + + can_attach_attachment = fields.Boolean() + object_attachment_ids = fields.Many2many( + comodel_name="ir.attachment", + relation="mail_compose_message_ir_attachments_object_rel", + column1="wizard_id", + column2="attachment_id", + string="Object Attachments", + ) + display_object_attachment_ids = fields.One2many( + comodel_name="ir.attachment", + compute="_compute_display_object_attachment_ids", + ) + + @api.depends("res_ids", "model") + def _compute_display_object_attachment_ids(self): + for composer in self: + res_ids = self._evaluate_res_ids() + model = self.model + if model and res_ids: + attachments = self.env["ir.attachment"].search( + [ + ("res_model", "=", model), + ("res_id", "in", res_ids), + ] + ) + composer.display_object_attachment_ids = attachments + else: + composer.display_object_attachment_ids = False + + def _prepare_mail_values(self, res_ids): + res = super()._prepare_mail_values(res_ids) + if self.object_attachment_ids.ids and self.model and len(res_ids) == 1: + res[res_ids[0]].setdefault("attachment_ids", []).extend( + self.object_attachment_ids.ids + ) + return res diff --git a/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml b/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml new file mode 100644 index 000000000..e0b816258 --- /dev/null +++ b/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml @@ -0,0 +1,19 @@ + + + + mail.compose.message + + + + + + + + + + diff --git a/mail_attach_existing_attachment_account/README.rst b/mail_attach_existing_attachment_account/README.rst new file mode 100644 index 000000000..1d3eca804 --- /dev/null +++ b/mail_attach_existing_attachment_account/README.rst @@ -0,0 +1,87 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +========================================= +Mail Attach Existing Attachment (Account) +========================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:85a891a10dde9cc1e76064ff7ae74d340b1eb2d3a72cb1ad3d69468251535ac0 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fmail-lightgray.png?logo=github + :target: https://github.com/OCA/mail/tree/19.0/mail_attach_existing_attachment_account + :alt: OCA/mail +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/mail-19-0/mail-19-0-mail_attach_existing_attachment_account + :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=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This Module adds the mail_attach_existing_attachment feature to the +account module, since there is a change in odoo 12.0, which adds a new +mail wizard form to the account module + +**Table of contents** + +.. contents:: + :local: + +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 +------- + +* Thore Baden + +Contributors +------------ + +- Thore Baden +- `Tecnativa `__: + + - Víctor Martínez + - Ernesto Tejeda + - Carlos Lopez + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_attach_existing_attachment_account/__init__.py b/mail_attach_existing_attachment_account/__init__.py new file mode 100644 index 000000000..78695683c --- /dev/null +++ b/mail_attach_existing_attachment_account/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import wizard diff --git a/mail_attach_existing_attachment_account/__manifest__.py b/mail_attach_existing_attachment_account/__manifest__.py new file mode 100644 index 000000000..4d039a633 --- /dev/null +++ b/mail_attach_existing_attachment_account/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2019 Thore Baden +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Mail Attach Existing Attachment (Account)", + "summary": "Module to use attach existing attachment for account module", + "author": "Thore Baden, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/mail", + "category": "Social Network", + "version": "19.0.1.0.0", + "license": "AGPL-3", + "depends": ["account", "mail_attach_existing_attachment"], + "data": ["wizard/account_move_send_wizard_view.xml"], + "installable": True, + "auto_install": True, +} diff --git a/mail_attach_existing_attachment_account/i18n/it.po b/mail_attach_existing_attachment_account/i18n/it.po new file mode 100644 index 000000000..024ab3d36 --- /dev/null +++ b/mail_attach_existing_attachment_account/i18n/it.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment_account +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-12-19 10: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_attach_existing_attachment_account +#: model:ir.model,name:mail_attach_existing_attachment_account.model_account_invoice_send +msgid "Account Invoice Send" +msgstr "Conto invio fattura" + +#. module: mail_attach_existing_attachment_account +#: model:ir.model.fields,field_description:mail_attach_existing_attachment_account.field_account_invoice_send__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "Può inserire allegati" diff --git a/mail_attach_existing_attachment_account/i18n/mail_attach_existing_attachment_account.pot b/mail_attach_existing_attachment_account/i18n/mail_attach_existing_attachment_account.pot new file mode 100644 index 000000000..f60ddabef --- /dev/null +++ b/mail_attach_existing_attachment_account/i18n/mail_attach_existing_attachment_account.pot @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_attach_existing_attachment_account +# +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_attach_existing_attachment_account +#: model:ir.model,name:mail_attach_existing_attachment_account.model_account_move_send_wizard +msgid "Account Move Send Wizard" +msgstr "" + +#. module: mail_attach_existing_attachment_account +#: model:ir.model.fields,field_description:mail_attach_existing_attachment_account.field_account_move_send_wizard__can_attach_attachment +msgid "Can Attach Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment_account +#: model:ir.model.fields,field_description:mail_attach_existing_attachment_account.field_account_move_send_wizard__display_object_attachment_ids +msgid "Display Object Attachment" +msgstr "" + +#. module: mail_attach_existing_attachment_account +#: model:ir.model.fields,field_description:mail_attach_existing_attachment_account.field_account_move_send_wizard__object_attachment_ids +msgid "Object Attachments" +msgstr "" diff --git a/mail_attach_existing_attachment_account/pyproject.toml b/mail_attach_existing_attachment_account/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/mail_attach_existing_attachment_account/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_attach_existing_attachment_account/readme/CONTRIBUTORS.md b/mail_attach_existing_attachment_account/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..75dd8847c --- /dev/null +++ b/mail_attach_existing_attachment_account/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- Thore Baden \ +- [Tecnativa](https://www.tecnativa.com): + - Víctor Martínez + - Ernesto Tejeda + - Carlos Lopez diff --git a/mail_attach_existing_attachment_account/readme/DESCRIPTION.md b/mail_attach_existing_attachment_account/readme/DESCRIPTION.md new file mode 100644 index 000000000..6fb430e40 --- /dev/null +++ b/mail_attach_existing_attachment_account/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This Module adds the mail_attach_existing_attachment feature to the +account module, since there is a change in odoo 12.0, which adds a new +mail wizard form to the account module diff --git a/mail_attach_existing_attachment_account/static/description/icon.png b/mail_attach_existing_attachment_account/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/mail_attach_existing_attachment_account/static/description/icon.png differ diff --git a/mail_attach_existing_attachment_account/static/description/index.html b/mail_attach_existing_attachment_account/static/description/index.html new file mode 100644 index 000000000..be725df5a --- /dev/null +++ b/mail_attach_existing_attachment_account/static/description/index.html @@ -0,0 +1,437 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Mail Attach Existing Attachment (Account)

+ +

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

+

This Module adds the mail_attach_existing_attachment feature to the +account module, since there is a change in odoo 12.0, which adds a new +mail wizard form to the account module

+

Table of contents

+ +
+

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

+
    +
  • Thore Baden
  • +
+
+
+

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.

+

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

+

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

+
+
+
+
+ + diff --git a/mail_attach_existing_attachment_account/tests/__init__.py b/mail_attach_existing_attachment_account/tests/__init__.py new file mode 100644 index 000000000..277c7fbde --- /dev/null +++ b/mail_attach_existing_attachment_account/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mail_attach_existing_attachment_account diff --git a/mail_attach_existing_attachment_account/tests/test_mail_attach_existing_attachment_account.py b/mail_attach_existing_attachment_account/tests/test_mail_attach_existing_attachment_account.py new file mode 100644 index 000000000..d47b8c1f6 --- /dev/null +++ b/mail_attach_existing_attachment_account/tests/test_mail_attach_existing_attachment_account.py @@ -0,0 +1,39 @@ +# Copyright 2021 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.tests import Form + +from odoo.addons.base.tests.common import BaseCommon + + +class TestMailAttachExistingAttachmentAccount(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product = cls.env["product.product"].create({"name": "Test product"}) + cls.partner = cls.env["res.partner"].create({"name": "Mr. Odoo"}) + cls.journal = cls.env["account.journal"].create( + {"name": "Test sale journal", "code": "TSALE", "type": "sale"} + ) + invoice_form = Form( + cls.env["account.move"].with_context(default_move_type="out_invoice") + ) + invoice_form.partner_id = cls.partner + with invoice_form.invoice_line_ids.new() as line_form: + line_form.product_id = cls.product + cls.invoice = invoice_form.save() + cls.invoice.action_post() + + def test_account_invoice_send(self): + compose = Form( + self.env["account.move.send.wizard"].with_context( + active_ids=self.invoice.ids, + default_model=self.invoice._name, + default_res_id=self.invoice.id, + default_res_model=self.invoice._name, + ) + ) + self.assertTrue(compose.can_attach_attachment) + wizard = compose.save() + self.assertFalse(wizard.display_object_attachment_ids) + wizard.move_id = False + self.assertFalse(wizard.display_object_attachment_ids) diff --git a/mail_attach_existing_attachment_account/wizard/__init__.py b/mail_attach_existing_attachment_account/wizard/__init__.py new file mode 100644 index 000000000..589b902be --- /dev/null +++ b/mail_attach_existing_attachment_account/wizard/__init__.py @@ -0,0 +1 @@ +from . import account_move_send_wizard diff --git a/mail_attach_existing_attachment_account/wizard/account_move_send_wizard.py b/mail_attach_existing_attachment_account/wizard/account_move_send_wizard.py new file mode 100644 index 000000000..f0e02219b --- /dev/null +++ b/mail_attach_existing_attachment_account/wizard/account_move_send_wizard.py @@ -0,0 +1,48 @@ +# Copyright 2021 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class AccountMoveSendWizard(models.TransientModel): + _inherit = "account.move.send.wizard" + + can_attach_attachment = fields.Boolean() + object_attachment_ids = fields.Many2many( + comodel_name="ir.attachment", + relation="account_move_send_wizard_ir_attachments_object_rel", + column1="wizard_id", + column2="attachment_id", + string="Object Attachments", + ) + display_object_attachment_ids = fields.One2many( + comodel_name="ir.attachment", + compute="_compute_display_object_attachment_ids", + ) + + @api.depends("move_id") + def _compute_display_object_attachment_ids(self): + for wizard in self: + if self.move_id: + attachments = self.env["ir.attachment"].search( + [ + ("res_model", "=", "account.move"), + ("res_id", "=", self.move_id.id), + ] + ) + wizard.display_object_attachment_ids = attachments + else: + wizard.display_object_attachment_ids = False + + @api.model + def _get_invoice_extra_attachments(self, move): + res = super()._get_invoice_extra_attachments(move) + res |= self.object_attachment_ids + return res + + @api.model + def default_get(self, fields_list): + res = super().default_get(fields_list) + if res.get("move_id") and not res.get("can_attach_attachment"): + res["can_attach_attachment"] = True # pragma: no cover + return res diff --git a/mail_attach_existing_attachment_account/wizard/account_move_send_wizard_view.xml b/mail_attach_existing_attachment_account/wizard/account_move_send_wizard_view.xml new file mode 100644 index 000000000..3693ac299 --- /dev/null +++ b/mail_attach_existing_attachment_account/wizard/account_move_send_wizard_view.xml @@ -0,0 +1,24 @@ + + + + + account.move.send.wizard.form + account.move.send.wizard + + + + + + + + +