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

[18.0][MIG] partner_email_check: Migration to 18.0 #6

Open
wants to merge 51 commits into
base: 18.0
Choose a base branch
from

Conversation

Kimkhoi3010
Copy link
Owner

@Kimkhoi3010 Kimkhoi3010 commented Oct 15, 2024

I add 1 PR: OCA#1854
to update res_config_settings_view_form and view_general_configuration

denislour and others added 30 commits October 15, 2024 12:36
* Add new module partner-email-check
Validate email input
- 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/
francesco-ooops and others added 17 commits October 15, 2024 12:36
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/
@chaule97
Copy link

Please add my PR OCA#1854

for rec in self.filtered("email"):
if "," in rec.email:
raise UserError(
_(

Choose a reason for hiding this comment

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

Suggested change
_(
self.env._(

)
if self.search_count([("email", "=", rec.email), ("id", "!=", rec.id)]):
raise UserError(
_("Email '%s' is already in use.") % rec.email.strip()

Choose a reason for hiding this comment

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

Suggested change
_("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()

Choose a reason for hiding this comment

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

Suggested change
_("%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()

Choose a reason for hiding this comment

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

Suggested change
_("Cannot deliver to email address %s") % email.strip()
self.env._("Cannot deliver to email address %s", email.strip())

chaule97 and others added 2 commits October 22, 2024 10:17
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.
@Kimkhoi3010 Kimkhoi3010 force-pushed the 18.0-mig-partner_email_check branch 2 times, most recently from 3840965 to 5fa110d Compare October 22, 2024 03:20
"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()

Choose a reason for hiding this comment

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

Suggested change
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()

Choose a reason for hiding this comment

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

Suggested change
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()

Choose a reason for hiding this comment

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

Suggested change
self.env._("Cannot deliver to email address %s") % email.strip()
self.env._("Cannot deliver to email address %s", email.strip())

Copy link

@chaule97 chaule97 left a 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

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

Successfully merging this pull request may close these issues.