-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2834][ADD] outgoing_email_by_model (#82)
[ADD] outgoing_email_by_model
- Loading branch information
Showing
19 changed files
with
794 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:f46c9dd50baab7014312147699cdd79186d1cc231a643f0b762894a973f43b36 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/15.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-15-0/social-15-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=15.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:%2015.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 SA | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Matthieu Méquignon <[email protected]> | ||
|
||
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/15.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,23 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://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 SA, 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,2 @@ | ||
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,22 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://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,19 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
||
from odoo import models | ||
|
||
|
||
class MailThread(models.AbstractModel): | ||
_inherit = "mail.thread" | ||
|
||
def _notify_by_email_add_values(self, base_values): | ||
res = super()._notify_by_email_add_values(base_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 @@ | ||
* Matthieu Méquignon <[email protected]> |
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.