Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] mail_outbound_static: Migration to 15.0 #841

Merged
merged 20 commits into from
Mar 3, 2022

Conversation

yankinmax
Copy link
Contributor

Including commits from PR #598

lasley and others added 19 commits January 26, 2022 09:34
* Allow for the configuration of the FROM header for outbound emails, and move the existing from header to Sender as per RFC-2822
Fixing and extending tests
Add setup
Co-Authored-By: Jairo Llopis <Yajo@users.noreply.github.com>
use sudo to get ir.config_parameter, otherwise when normal users try to
send email they get AccessError
- fix misspellings errors in documentation
- add unit test to avoid github checkers red status in codecov tests.
- add validation of email from and domain whitelist fields.
- update documentation remove roadmap for already updated functionalities.
- update translations
@yankinmax
Copy link
Contributor Author

@rousseldenis @zaoral

@yankinmax
Copy link
Contributor Author

@simahawk can you pls take a look?

@simahawk
Copy link
Contributor

@yankinmax pls check the build

from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase

from odoo.addons.base.tests.common import MockSmtplibCase
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simahawk @rousseldenis
With this improvement odoo/odoo@1b9dd11
I propose to improve tests, as they are failing using https://docs.python.org/3/library/unittest.mock.html#module-unittest.mock

Comment on lines +78 to +111
def _send_mail(
self,
message,
mail_server_id=None,
smtp_server=None,
smtp_port=None,
smtp_user=None,
smtp_password=None,
smtp_encryption=None,
smtp_ssl_certificate=None,
smtp_ssl_private_key=None,
smtp_debug=False,
smtp_session=None,
):
smtp = smtp_session
if not smtp:
smtp = self.IrMailServer.connect(
smtp_server,
smtp_port,
smtp_user,
smtp_password,
smtp_encryption,
smtp_from=message["From"],
ssl_certificate=smtp_ssl_certificate,
ssl_private_key=smtp_ssl_private_key,
smtp_debug=smtp_debug,
mail_server_id=mail_server_id,
)

send_from, send_to, message_string = self.IrMailServer._prepare_email_message(
message, smtp
)
self.IrMailServer.send_email(message)
return message_string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed, just because, I'm not an expert with email servers and couldn't find any other idea how to get smtp_seesion parameter to pass directly to _prepare_email_message method of ir.mail_server.
Would really appreciate any guidance. Thanks

@yankinmax yankinmax mentioned this pull request Feb 1, 2022
36 tasks
Copy link

@leemannd leemannd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems legit, but It is maybe not necessary anymore if we have a good setup of the system parameters and this commit -> odoo/odoo@044532a

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@simahawk
Copy link
Contributor

simahawk commented Feb 2, 2022

hmm it's slightly different here as the FROM comes from the server record and not from config param.
Also, that commit seems not to be in 15.0 yet

https://github.com/odoo/odoo/blob/044532aed6f796cd93e37556b4a8ce47d2c23a7c/odoo/addons/base/models/ir_mail_server.py#L417

https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/models/ir_mail_server.py

I'd add a TODO to evaluate overriding _get_email_from in future versions.

@gurneyalex what do you think?

@dreispt
Copy link
Sponsor Member

dreispt commented Mar 3, 2022

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 15.0-ocabot-merge-pr-841-by-dreispt-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 3b491aa into OCA:15.0 Mar 3, 2022
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 8902b1e. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.