Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
894 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,101 @@ | ||
=================== | ||
Mail Operating Unit | ||
=================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html | ||
:alt: License: LGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github | ||
:target: https://github.com/OCA/operating-unit/tree/12.0/mail_operating_unit | ||
:alt: OCA/operating-unit | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/operating-unit-12-0/operating-unit-12-0-mail_operating_unit | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/213/12.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module introduces the following features: | ||
|
||
* It introduces the operating unit (OU) to mail. | ||
* We have the possibility to set an outgoing mail for each OU. | ||
* We have the possibility to set the OU for each mail alias. | ||
* If an OU is set in an mail alias it sets the domain according its OU. | ||
* We have the possibility to set the OU for each mail template. | ||
* If we sent a mail (ex. via sale order) we can only select the templates of | ||
the same model where the OU is not set or of the same OU. | ||
* If we sent a mail within a record it sets the sender_email_address (alias | ||
and domain) and reply_to according its OU. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
Follow these steps to make it working: | ||
|
||
#. Create an Outgoing Mail Server. | ||
#. Use a current Operating Unit (OU) or create a new one. | ||
#. Set values into the new fields 'Catchall alias', 'Catchall domain', | ||
'Outgoing Mail Server'). | ||
#. Assignment of an OU to a mail alias. Then it takes the domain set in the OU | ||
as domain for this mail alias. If no OU set, it takes the one from system | ||
parameters. If the set OU has no 'Catchall domain' set, it stays | ||
empty. | ||
#. Assignment of an OU to a mail template. If we sent a mail (ex. via sale | ||
order) we can only select the templates of the same model where the OU is | ||
not set or of the same OU. If we sent a mail within a record it sets the | ||
sender_email_address (alias and domain) and reply_to according its OU. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/operating-unit/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/operating-unit/issues/new?body=module:%20mail_operating_unit%0Aversion:%2012.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 | ||
~~~~~~~ | ||
|
||
* brain-tec AG | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Olivier Jossen <olivier.jossen@braintec-group.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. | ||
|
||
This module is part of the `OCA/operating-unit <https://github.com/OCA/operating-unit/tree/12.0/mail_operating_unit>`_ 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,9 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2019 brain-tec AG (http://www.braintec-group.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
# | ||
############################################################################## | ||
|
||
from . import models | ||
from . import wizard |
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,27 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2019 brain-tec AG (http://www.braintec-group.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
# | ||
############################################################################## | ||
|
||
{ | ||
"name": "Mail Operating Unit", | ||
"summary": "Adds the concept of operating unit (OU) according mail", | ||
"version": "12.0.1.0.0", | ||
"author": "brain-tec AG, " | ||
"Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/operating-unit", | ||
"category": "Purchase Management", | ||
"depends": ["operating_unit", "mail"], | ||
"license": "LGPL-3", | ||
"data": [ | ||
"security/mail_alias_security.xml", | ||
"security/mail_template_security.xml", | ||
"views/operating_unit_views_ext.xml", | ||
"views/mail_alias_views_ext.xml", | ||
"views/mail_template_views_ext.xml", | ||
"wizard/mail_compose_message_view_ext.xml", | ||
], | ||
"installable": True, | ||
} |
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,11 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2019 brain-tec AG (http://www.braintec-group.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
# | ||
############################################################################## | ||
|
||
from . import mail_alias_ext | ||
from . import mail_mail_ext | ||
from . import mail_template_ext | ||
from . import operating_unit |
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,21 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2019 brain-tec AG (http://www.braintec-group.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
# | ||
############################################################################## | ||
|
||
from odoo import fields, models, api | ||
|
||
|
||
class MailAliasExt(models.Model): | ||
_inherit = 'mail.alias' | ||
|
||
operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit') | ||
|
||
@api.multi | ||
def _get_alias_domain(self): | ||
super(MailAliasExt, self)._get_alias_domain() | ||
for record in self: | ||
if record.operating_unit_id: | ||
record.alias_domain = record.operating_unit_id.catchall_domain |
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,41 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2019 brain-tec AG (http://www.braintec-group.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
# | ||
############################################################################## | ||
|
||
from odoo import api, models | ||
from email.utils import formataddr | ||
|
||
|
||
class MailMailExt(models.Model): | ||
_inherit = 'mail.mail' | ||
|
||
@api.model_create_multi | ||
def create(self, vals_list): | ||
mails = super(MailMailExt, self).create(vals_list) | ||
|
||
for mail in mails: | ||
if mail.mail_message_id.model and \ | ||
mail.mail_message_id.res_id: | ||
|
||
model = mail.mail_message_id.model | ||
res_id = mail.mail_message_id.res_id | ||
record = self.env[model].browse(res_id) | ||
|
||
if getattr(record, 'operating_unit_id', False): | ||
if record.operating_unit_id.catchall_alias and \ | ||
record.operating_unit_id.catchall_domain: | ||
sender_email_address = \ | ||
record.operating_unit_id.catchall_alias + '@' + \ | ||
record.operating_unit_id.catchall_domain | ||
email_name = record.operating_unit_id.partner_id.name | ||
mail.email_from = \ | ||
formataddr((email_name, sender_email_address)) | ||
mail.reply_to = mail.email_from | ||
if record.operating_unit_id.outgoing_mail_server_id: | ||
mail.mail_server_id =\ | ||
record.operating_unit_id.outgoing_mail_server_id.id | ||
|
||
return mails |
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,14 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2019 brain-tec AG (http://www.braintec-group.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
# | ||
############################################################################## | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class MailTemplateExt(models.Model): | ||
_inherit = 'mail.template' | ||
|
||
operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit') |
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,18 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2019 brain-tec AG (http://www.braintec-group.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
# | ||
############################################################################## | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class OperatingUnitExt(models.Model): | ||
|
||
_inherit = 'operating.unit' | ||
|
||
catchall_alias = fields.Char(string='Catchall alias') | ||
catchall_domain = fields.Char(string='Catchall domain') | ||
outgoing_mail_server_id = fields.Many2one( | ||
'ir.mail_server', string='Outgoing Mail Server') |
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 @@ | ||
* Olivier Jossen <olivier.jossen@braintec-group.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,11 @@ | ||
This module introduces the following features: | ||
|
||
- It introduces the operating unit (OU) to mail. | ||
- We have the possibility to set an outgoing mail for each OU. | ||
- We have the possibility to set the OU for each mail alias. | ||
- If an OU is set in an mail alias it sets the domain according its OU. | ||
- We have the possibility to set the OU for each mail template. | ||
- If we sent a mail (ex. via sale order) we can only select the templates of | ||
the same model where the OU is not set or of the same OU. | ||
- If we sent a mail within a record it sets the sender_email_address (alias and | ||
domain) and reply_to according its OU. |
Empty file.
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,12 @@ | ||
#. Create an Outgoing Mail Server. | ||
#. Use a current Operating Unit (OU) or create a new one. | ||
#. Set values into the new fields 'Catchall alias', 'Catchall domain', | ||
'Outgoing Mail Server'). | ||
#. Assignment of an OU to a mail alias. Then it takes the domain set in the OU | ||
as domain for this mail alias. If no OU set, it takes the one from system | ||
parameters. If the set OU has no 'Catchall domain' set, it stays | ||
empty. | ||
#. Assignment of an OU to a mail template. If we sent a mail (ex. via sale | ||
order) we can only select the templates of the same model where the OU is | ||
not set or of the same OU. If we sent a mail within a record it sets the | ||
sender_email_address (alias and domain) and reply_to according its OU. |
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 (c) 2019 brain-tec AG (http://www.braintec-group.com) | ||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
--> | ||
<odoo> | ||
|
||
<record id="ir_rule_mail_alias_allowed_operating_units" model="ir.rule"> | ||
<field name="model_id" ref="mail.model_mail_alias"/> | ||
<field name="domain_force">['|',('operating_unit_id','=',False), | ||
('operating_unit_id','in',user.operating_unit_ids.ids)]</field> | ||
<field name="name">Mail Aliases from allowed operating units</field> | ||
<field name="global" eval="True"/> | ||
<field eval="0" name="perm_unlink"/> | ||
<field eval="0" name="perm_write"/> | ||
<field eval="1" name="perm_read"/> | ||
<field eval="0" name="perm_create"/> | ||
</record> | ||
|
||
</odoo> |
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 (c) 2019 brain-tec AG (http://www.braintec-group.com) | ||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
--> | ||
<odoo> | ||
|
||
<record id="ir_rule_mail_template_allowed_operating_units" model="ir.rule"> | ||
<field name="model_id" ref="mail.model_mail_template"/> | ||
<field name="domain_force">['|',('operating_unit_id','=',False), | ||
('operating_unit_id','in',user.operating_unit_ids.ids)]</field> | ||
<field name="name">Mail Templates from allowed operating units</field> | ||
<field name="global" eval="True"/> | ||
<field eval="0" name="perm_unlink"/> | ||
<field eval="0" name="perm_write"/> | ||
<field eval="1" name="perm_read"/> | ||
<field eval="0" name="perm_create"/> | ||
</record> | ||
|
||
</odoo> |
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.