Browse Source

[IMP] partner_email_check: black, isort, prettier

14.0
Zar21 3 years ago
parent
commit
cb464c0226
  1. 9
      partner_email_check/models/res_config_settings.py
  2. 5
      partner_email_check/models/res_partner.py
  3. 2
      requirements.txt
  4. 1
      setup/partner_email_check/odoo/addons/partner_email_check
  5. 6
      setup/partner_email_check/setup.py

9
partner_email_check/models/res_config_settings.py

@ -5,15 +5,18 @@ class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings" _inherit = "res.config.settings"
partner_email_check_syntax = fields.Boolean( partner_email_check_syntax = fields.Boolean(
related="company_id.partner_email_check_syntax", readonly=False,
related="company_id.partner_email_check_syntax",
readonly=False,
) )
partner_email_check_filter_duplicates = fields.Boolean( partner_email_check_filter_duplicates = fields.Boolean(
related="company_id.partner_email_check_filter_duplicates", readonly=False,
related="company_id.partner_email_check_filter_duplicates",
readonly=False,
) )
partner_email_check_check_deliverability = fields.Boolean( partner_email_check_check_deliverability = fields.Boolean(
related="company_id.partner_email_check_check_deliverability", readonly=False,
related="company_id.partner_email_check_check_deliverability",
readonly=False,
) )
@api.onchange( @api.onchange(

5
partner_email_check/models/res_partner.py

@ -10,9 +10,9 @@ _logger = logging.getLogger(__name__)
try: try:
from email_validator import ( from email_validator import (
validate_email,
EmailSyntaxError, EmailSyntaxError,
EmailUndeliverableError, EmailUndeliverableError,
validate_email,
) )
except ImportError: except ImportError:
_logger.debug('Cannot import "email_validator".') _logger.debug('Cannot import "email_validator".')
@ -67,7 +67,8 @@ class ResPartner(models.Model):
try: try:
result = validate_email( result = validate_email(
email, check_deliverability=self._should_check_deliverability(),
email,
check_deliverability=self._should_check_deliverability(),
) )
except EmailSyntaxError: except EmailSyntaxError:
raise ValidationError(_("%s is an invalid email") % email.strip()) raise ValidationError(_("%s is an invalid email") % email.strip())

2
requirements.txt

@ -0,0 +1,2 @@
# generated from manifests external_dependencies
email-validator

1
setup/partner_email_check/odoo/addons/partner_email_check

@ -0,0 +1 @@
../../../../partner_email_check

6
setup/partner_email_check/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save