-
-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][MIG] outgoing_email_by_model: Migration to 16.0
- Loading branch information
1 parent
fb34dbb
commit 004c6d4
Showing
18 changed files
with
813 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
======================= | ||
Outgoing Email by Model | ||
======================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:0de5a293f68d4c9a7b9b358dbbd1c678a8278e1fadcf1b0876b521d4dba266dc | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/16.0/outgoing_email_by_model | ||
:alt: OCA/social | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-outgoing_email_by_model | ||
: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=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Allow to select an outgoing mail parameters per model, such as email_from, or mail_server_id. | ||
|
||
To make it work, the model must inherit `mail.thread`. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
If you want to use a specific outgoing mail for a model, populate the following fields in the model record (Settings > Technical > Models) accordingly: | ||
|
||
* Outgoing Mailserver: Set an outgoing mail server. This will be used as the forced outgoing mail server for the model. | ||
* Outgoing Email: Set an email address. This will be used as the outgoing email for the model. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/social/issues/new?body=module:%20outgoing_email_by_model%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Camptocamp | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Emilie SOUTIRAS <emilie.soutiras@groupevoltaire.com> | ||
|
||
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-mmequignon| image:: https://github.com/mmequignon.png?size=40px | ||
:target: https://github.com/mmequignon | ||
:alt: mmequignon | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-mmequignon| | ||
|
||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/outgoing_email_by_model>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2024 Groupe Voltaire | ||
# @author Emilie SOUTIRAS <emilie.soutiras@groupevoltaire.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Outgoing Email by Model", | ||
"version": "15.0.1.0.0", | ||
"category": "Social", | ||
"website": "https://github.com/OCA/social", | ||
"author": "Camptocamp, Odoo Community Association (OCA)", | ||
"maintainers": ["mmequignon"], | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"auto_install": False, | ||
"external_dependencies": { | ||
"python": ["odoo_test_helper"], | ||
}, | ||
"depends": [ | ||
"mail", | ||
], | ||
"data": [ | ||
"views/ir_model.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * outgoing_email_by_model | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.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: outgoing_email_by_model | ||
#: model:ir.model.fields,help:outgoing_email_by_model.field_ir_model__outgoing_email | ||
msgid "" | ||
"\n" | ||
" Allows to force the usage of a given email address if this setting is set.\n" | ||
" However, this setting will be active only if the model extends `mail.thread`.\n" | ||
msgstr "" | ||
|
||
#. module: outgoing_email_by_model | ||
#: model:ir.model.fields,help:outgoing_email_by_model.field_ir_model__outgoing_mailserver_id | ||
msgid "" | ||
"\n" | ||
" Allows to force the usage of a given outgoing mail server if this setting is set.\n" | ||
" However, this setting will be active only if the model extends `mail.thread`.\n" | ||
msgstr "" | ||
|
||
#. module: outgoing_email_by_model | ||
#: model:ir.model,name:outgoing_email_by_model.model_mail_thread | ||
msgid "Email Thread" | ||
msgstr "" | ||
|
||
#. module: outgoing_email_by_model | ||
#: model:ir.model,name:outgoing_email_by_model.model_ir_model | ||
msgid "Models" | ||
msgstr "" | ||
|
||
#. module: outgoing_email_by_model | ||
#: model:ir.model.fields,field_description:outgoing_email_by_model.field_ir_model__outgoing_email | ||
msgid "Outgoing Email" | ||
msgstr "" | ||
|
||
#. module: outgoing_email_by_model | ||
#: model:ir.model.fields,field_description:outgoing_email_by_model.field_ir_model__outgoing_mailserver_id | ||
msgid "Outgoing Mailserver" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright (c) 2024 Groupe Voltaire | ||
# @author Emilie SOUTIRAS <emilie.soutiras@groupevoltaire.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import ir_model | ||
from . import mail_thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2024 Groupe Voltaire | ||
# @author Emilie SOUTIRAS <emilie.soutiras@groupevoltaire.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
OUTGOING_MAILSERVER_DESCRIPTION = """ | ||
Allows to force the usage of a given outgoing mail server if this setting is set. | ||
However, this setting will be active only if the model extends `mail.thread`. | ||
""" | ||
OUTGOING_EMAIL_DESCRIPTION = """ | ||
Allows to force the usage of a given email address if this setting is set. | ||
However, this setting will be active only if the model extends `mail.thread`. | ||
""" | ||
|
||
|
||
class IrModel(models.Model): | ||
_inherit = "ir.model" | ||
|
||
outgoing_mailserver_id = fields.Many2one( | ||
"ir.mail_server", help=OUTGOING_MAILSERVER_DESCRIPTION | ||
) | ||
outgoing_email = fields.Char(help=OUTGOING_EMAIL_DESCRIPTION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2024 Groupe Voltaire | ||
# @author Emilie SOUTIRAS <emilie.soutiras@groupevoltaire.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class MailThread(models.AbstractModel): | ||
_inherit = "mail.thread" | ||
|
||
def _notify_by_email_get_final_mail_values( | ||
self, recipient_ids, base_mail_values, additional_values=None | ||
): | ||
res = super()._notify_by_email_get_final_mail_values( | ||
recipient_ids, base_mail_values, additional_values=additional_values | ||
) | ||
model = self.env["ir.model"].sudo().search([("model", "=", self._name)]) | ||
custom_mailserver = model.outgoing_mailserver_id | ||
if custom_mailserver: | ||
res.update({"mail_server_id": custom_mailserver.id}) | ||
custom_email = model.outgoing_email | ||
if custom_email: | ||
res.update({"email_from": custom_email}) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
If you want to use a specific outgoing mail for a model, populate the following fields in the model record (Settings > Technical > Models) accordingly: | ||
|
||
* Outgoing Mailserver: Set an outgoing mail server. This will be used as the forced outgoing mail server for the model. | ||
* Outgoing Email: Set an email address. This will be used as the outgoing email for the model. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Emilie SOUTIRAS <emilie.soutiras@groupevoltaire.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Allow to select an outgoing mail parameters per model, such as email_from, or mail_server_id. | ||
|
||
To make it work, the model must inherit `mail.thread`. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.