diff --git a/mail_server_user/README.rst b/mail_server_user/README.rst new file mode 100644 index 0000000000..c8014086fb --- /dev/null +++ b/mail_server_user/README.rst @@ -0,0 +1,82 @@ +===================== +Email Server For User +===================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:f4f4347f0f16244f1af534d28eec9d0e38bfc4a37b39fa6ddfe410939e91b128 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/16.0/mail_server_user + :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-mail_server_user + :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| + +Allows users to add their own outgoing mail server from the user preferences. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +#. There's a **Setup Outgoing Email Server** button in **User Preferences**,from where you can +configure your own mail server.Make sure that the **From Filtering** and the **Username** on the outgoing email server is set as your email if its supposed to be used only for your emails. + +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 +~~~~~~~ + +* Onestein + +Contributors +~~~~~~~~~~~~ + +* `Onestein `__ + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_server_user/__init__.py b/mail_server_user/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/mail_server_user/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mail_server_user/__manifest__.py b/mail_server_user/__manifest__.py new file mode 100644 index 0000000000..2aba9ca861 --- /dev/null +++ b/mail_server_user/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2024 Onestein B.V. +# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Email Server For User", + "summary": "Allows users to add their own outgoing mail server from the user preferences.", + "version": "16.0.1.0.0", + "category": "Social Network", + "website": "https://github.com/OCA/social", + "author": ("Onestein, " "Odoo Community Association (OCA)"), + "license": "LGPL-3", + "application": False, + "installable": True, + "depends": ["base", "mail"], + "data": [ + "security/ir.model.access.csv", + "security/res_groups.xml", + "views/res_users_view.xml", + ], +} diff --git a/mail_server_user/models/__init__.py b/mail_server_user/models/__init__.py new file mode 100644 index 0000000000..5ab805590d --- /dev/null +++ b/mail_server_user/models/__init__.py @@ -0,0 +1,2 @@ +from . import ir_mail_server +from . import res_users diff --git a/mail_server_user/models/ir_mail_server.py b/mail_server_user/models/ir_mail_server.py new file mode 100644 index 0000000000..6949a55f4f --- /dev/null +++ b/mail_server_user/models/ir_mail_server.py @@ -0,0 +1,12 @@ +# Copyright 2024 Onestein B.V. +# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class IrMailServer(models.Model): + _inherit = "ir.mail_server" + + smtp_user = fields.Char(groups="base.group_system,base.group_user") + smtp_pass = fields.Char(groups="base.group_system,base.group_user") + smtp_ssl_certificate = fields.Binary(groups="base.group_system,base.group_user") + smtp_ssl_private_key = fields.Binary(groups="base.group_system,base.group_user") diff --git a/mail_server_user/models/res_users.py b/mail_server_user/models/res_users.py new file mode 100644 index 0000000000..0ab913734b --- /dev/null +++ b/mail_server_user/models/res_users.py @@ -0,0 +1,28 @@ +# Copyright 2024 Onestein B.V. +# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import models + + +class ResUsers(models.Model): + _inherit = "res.users" + + def setup_outgoing_mail_server(self): + self.ensure_one() + ir_mail_server_id = self.env["ir.mail_server"].search([], limit=1) + if ir_mail_server_id and self.email: + # Make sure that from_filter and smtp_user is set to user's email + ir_mail_server_id.write( + {"from_filter": self.email, "smtp_user": self.email} + ) + return { + "type": "ir.actions.act_window", + "res_model": "ir.mail_server", + "name": "Setup Outgoing Mail Server", + "target": "new", + "views": [(False, "form")], + "res_id": ir_mail_server_id.id, + "context": { + "default_from_filter": self.email, + "default_smtp_user": self.email, + }, + } diff --git a/mail_server_user/readme/CONTRIBUTORS.rst b/mail_server_user/readme/CONTRIBUTORS.rst new file mode 100755 index 0000000000..ec57549307 --- /dev/null +++ b/mail_server_user/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* `Onestein `__ diff --git a/mail_server_user/readme/DESCRIPTION.rst b/mail_server_user/readme/DESCRIPTION.rst new file mode 100755 index 0000000000..ffaf35f73a --- /dev/null +++ b/mail_server_user/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Allows users to add their own outgoing mail server from the user preferences. \ No newline at end of file diff --git a/mail_server_user/readme/USAGE.rst b/mail_server_user/readme/USAGE.rst new file mode 100644 index 0000000000..42ccf12902 --- /dev/null +++ b/mail_server_user/readme/USAGE.rst @@ -0,0 +1,2 @@ +#. There's a **Setup Outgoing Email Server** button in **User Preferences**,from where you can +configure your own mail server.Make sure that the **From Filtering** and the **Username** on the outgoing email server is set as your email if its supposed to be used only for your emails. diff --git a/mail_server_user/security/ir.model.access.csv b/mail_server_user/security/ir.model.access.csv new file mode 100644 index 0000000000..1831f1b50f --- /dev/null +++ b/mail_server_user/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_ir_mail_server_user,access_ir_mail_server_user,base.model_ir_mail_server,base.group_user,1,1,1,1 diff --git a/mail_server_user/security/res_groups.xml b/mail_server_user/security/res_groups.xml new file mode 100644 index 0000000000..535ceb0195 --- /dev/null +++ b/mail_server_user/security/res_groups.xml @@ -0,0 +1,49 @@ + + + Access Outgoing Mail Server + + + + + + + + + ir.mail.server.user.rule + + + ['|','|',('from_filter', '=', user.email),('create_uid','=',user.id),('smtp_user', '=', user.email)] + + + + + + + + + + ir.mail.server.group_system.rule + + + [(1,'=',1)] + + + + + + + + diff --git a/mail_server_user/static/description/icon.png b/mail_server_user/static/description/icon.png new file mode 100755 index 0000000000..3a0328b516 Binary files /dev/null and b/mail_server_user/static/description/icon.png differ diff --git a/mail_server_user/static/description/index.html b/mail_server_user/static/description/index.html new file mode 100644 index 0000000000..8cd527d142 --- /dev/null +++ b/mail_server_user/static/description/index.html @@ -0,0 +1,429 @@ + + + + + +Email Server For User + + + +
+

Email Server For User

+ + +

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

+

Allows users to add their own outgoing mail server from the user preferences.

+

Table of contents

+ +
+

Usage

+

#. There’s a Setup Outgoing Email Server button in User Preferences,from where you can +configure your own mail server.Make sure that the From Filtering and the Username on the outgoing email server is set as your email if its supposed to be used only for your emails.

+
+
+

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

+
    +
  • Onestein
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

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

+

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

+
+
+
+ + diff --git a/mail_server_user/views/res_users_view.xml b/mail_server_user/views/res_users_view.xml new file mode 100644 index 0000000000..e476de4b62 --- /dev/null +++ b/mail_server_user/views/res_users_view.xml @@ -0,0 +1,33 @@ + + + + + Add outgoing mail server to user preferences form + + res.users + + + + +
+ Make sure the From Filtering and Username(if applicable) is set to your email +
+
+
+
+
+
+
+
diff --git a/setup/mail_server_user/odoo/addons/mail_server_user b/setup/mail_server_user/odoo/addons/mail_server_user new file mode 120000 index 0000000000..97c4880be1 --- /dev/null +++ b/setup/mail_server_user/odoo/addons/mail_server_user @@ -0,0 +1 @@ +../../../../mail_server_user \ No newline at end of file diff --git a/setup/mail_server_user/setup.py b/setup/mail_server_user/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/mail_server_user/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)