-
Notifications
You must be signed in to change notification settings - Fork 0
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
[18.0][MIG] partner_email_check: Migration to 18.0 #6
base: 18.0
Are you sure you want to change the base?
Conversation
* Add new module partner-email-check Validate email input
…validate_email in partner_email_check
- partner_email_check now uses email-validator instead of validate_email - Email addresses are normalized - There is a setting to enforce uniqueness of partner email addresses - There is a setting to check whether emails are deliverable (i.e. whether the domain resolves)
portal's tests set an invalid email address, `c@c`, that's rejected by the current version of partner_email_check. If partner_email_check is installed before portal's tests run then they fail. To solve this, skip email validation if tests are running, unless a key in the context is set to make the checks run anyway. That lets tests in other addons opt in to the checks as well. The previous update to partner_email_check didn't bump the version number, so do that now.
[REF] Partner email chack params on company [IMP] email_check [IMP] test partner_email_check use SavepointCase
Currently translated at 90.4% (19 of 21 strings) Translation: partner-contact-14.0/partner-contact-14.0-partner_email_check Translate-URL: https://translation.odoo-community.org/projects/partner-contact-14-0/partner-contact-14-0-partner_email_check/fr/
Currently translated at 42.8% (9 of 21 strings) Translation: partner-contact-14.0/partner-contact-14.0-partner_email_check Translate-URL: https://translation.odoo-community.org/projects/partner-contact-14-0/partner-contact-14-0-partner_email_check/it/
Currently translated at 100.0% (21 of 21 strings) Translation: partner-contact-14.0/partner-contact-14.0-partner_email_check Translate-URL: https://translation.odoo-community.org/projects/partner-contact-14-0/partner-contact-14-0-partner_email_check/it/
Currently translated at 100.0% (21 of 21 strings) Translation: partner-contact-14.0/partner-contact-14.0-partner_email_check Translate-URL: https://translation.odoo-community.org/projects/partner-contact-14-0/partner-contact-14-0-partner_email_check/it/
Currently translated at 100.0% (21 of 21 strings) Translation: partner-contact-14.0/partner-contact-14.0-partner_email_check Translate-URL: https://translation.odoo-community.org/projects/partner-contact-14-0/partner-contact-14-0-partner_email_check/it/
Currently translated at 100.0% (19 of 19 strings) Translation: partner-contact-16.0/partner-contact-16.0-partner_email_check Translate-URL: https://translation.odoo-community.org/projects/partner-contact-16-0/partner-contact-16-0-partner_email_check/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: partner-contact-17.0/partner-contact-17.0-partner_email_check Translate-URL: https://translation.odoo-community.org/projects/partner-contact-17-0/partner-contact-17-0-partner_email_check/
Currently translated at 100.0% (19 of 19 strings) Translation: partner-contact-17.0/partner-contact-17.0-partner_email_check Translate-URL: https://translation.odoo-community.org/projects/partner-contact-17-0/partner-contact-17-0-partner_email_check/it/
67a3658
to
8111a98
Compare
Please add my PR OCA#1854 |
for rec in self.filtered("email"): | ||
if "," in rec.email: | ||
raise UserError( | ||
_( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_( | |
self.env._( |
) | ||
if self.search_count([("email", "=", rec.email), ("id", "!=", rec.id)]): | ||
raise UserError( | ||
_("Email '%s' is already in use.") % rec.email.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_("Email '%s' is already in use.") % rec.email.strip() | |
self.env._("Email '%s' is already in use.", rec.email.strip()) |
) | ||
except EmailSyntaxError: | ||
raise ValidationError( | ||
_("%s is an invalid email") % email.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_("%s is an invalid email") % email.strip() | |
self.env._("%s is an invalid email", email.strip()) |
) from EmailSyntaxError | ||
except EmailUndeliverableError: | ||
raise ValidationError( | ||
_("Cannot deliver to email address %s") % email.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_("Cannot deliver to email address %s") % email.strip() | |
self.env._("Cannot deliver to email address %s", email.strip()) |
The res_config_settings_view_form in Odoo 17 has changed its xml style, and the view_general_configuration in this module was written using Odoo 16 styling. So we need to update it accordingly.
3840965
to
5fa110d
Compare
"Field contains multiple email addresses. This is " | ||
"not supported when duplicate email addresses are " | ||
"not allowed." | ||
) | ||
) | ||
if self.search_count([("email", "=", rec.email), ("id", "!=", rec.id)]): | ||
raise UserError( | ||
_("Email '%s' is already in use.") % rec.email.strip() | ||
self.env._("Email '%s' is already in use.") % rec.email.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.env._("Email '%s' is already in use.") % rec.email.strip() | |
self.env._("Email '%s' is already in use.", email.strip()) |
@@ -72,11 +72,11 @@ def _normalize_email(self, email): | |||
) | |||
except EmailSyntaxError: | |||
raise ValidationError( | |||
_("%s is an invalid email") % email.strip() | |||
self.env._("%s is an invalid email") % email.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.env._("%s is an invalid email") % email.strip() | |
self.env._("%s is an invalid email", email.strip()) |
) from EmailSyntaxError | ||
except EmailUndeliverableError: | ||
raise ValidationError( | ||
_("Cannot deliver to email address %s") % email.strip() | ||
self.env._("Cannot deliver to email address %s") % email.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.env._("Cannot deliver to email address %s") % email.strip() | |
self.env._("Cannot deliver to email address %s", email.strip()) |
5fa110d
to
008cf41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-approve:
Please add my PR in your Description
I add 1 PR: OCA#1854
to update res_config_settings_view_form and view_general_configuration