
from odoo import api, models
from odoo.tools import email_split


class PortalWizard(models.TransientModel):
    _inherit = 'portal.wizard'


class PortalUser(models.TransientModel):
    _inherit = 'portal.wizard.user'

    @api.multi
    def _create_user(self):
        """
        Override portal user creation to prevent sending e-mail to new user.
        """
        res_users = self.env['res.users'].with_context(
            noshortcut=True, no_reset_password=True)
        email = email_split(self.email)
        if email:
            email = email[0]
        else:
            email = self.partner_id.lastname.lower() + '@cs.local'
        values = {
            'email': email,
            'login': email,
            'partner_id': self.partner_id.id,
            'groups_id': [(6, 0, [])],
            'notify_email': 'none',
        }
        return res_users.create(values)

    @api.multi
    def _send_email(self):
        """ Never send invitation e-mails. """
        return True


from odoo import api, models
from odoo.tools import email_split


class PortalWizard(models.TransientModel):
    _inherit = 'portal.wizard'


class PortalUser(models.TransientModel):
    _inherit = 'portal.wizard.user'

    @api.multi
    def _create_user(self):
        """
        Override portal user creation to prevent sending e-mail to new user.
        """
        res_users = self.env['res.users'].with_context(
            noshortcut=True, no_reset_password=True)
        email = email_split(self.email)
        if email:
            email = email[0]
        else:
            email = self.partner_id.lastname.lower() + '@cs.local'
        values = {
            'email': email,
            'login': email,
            'partner_id': self.partner_id.id,
            'groups_id': [(6, 0, [])],
            'notify_email': 'none',
        }
        res = res_users.create(values)
        res.notify_email = 'always'
        return res

    @api.multi
    def _send_email(self):
        """ Never send invitation e-mails. """
        return True

Fix bug, set notify_email to always after create portal user
Fix bug, set notify_email to always after create portal user


  
  from odoo import api, models
  from odoo.tools import email_split
  
  
  class PortalWizard(models.TransientModel):
      _inherit = 'portal.wizard'
  
  
  class PortalUser(models.TransientModel):
      _inherit = 'portal.wizard.user'
  
      @api.multi
      def _create_user(self):
          """
          Override portal user creation to prevent sending e-mail to new user.
          """
          res_users = self.env['res.users'].with_context(
              noshortcut=True, no_reset_password=True)
          email = email_split(self.email)
          if email:
              email = email[0]
          else:
              email = self.partner_id.lastname.lower() + '@cs.local'
          values = {
              'email': email,
              'login': email,
              'partner_id': self.partner_id.id,
              'groups_id': [(6, 0, [])],
              'notify_email': 'none',
          }
-         return res_users.create(values)
+         res = res_users.create(values)
+         res.notify_email = 'always'
+         return res
  
      @api.multi
      def _send_email(self):
          """ Never send invitation e-mails. """
          return True
  
Fix bug, set notify_email to always after create portal user
## Code Before:

from odoo import api, models
from odoo.tools import email_split


class PortalWizard(models.TransientModel):
    _inherit = 'portal.wizard'


class PortalUser(models.TransientModel):
    _inherit = 'portal.wizard.user'

    @api.multi
    def _create_user(self):
        """
        Override portal user creation to prevent sending e-mail to new user.
        """
        res_users = self.env['res.users'].with_context(
            noshortcut=True, no_reset_password=True)
        email = email_split(self.email)
        if email:
            email = email[0]
        else:
            email = self.partner_id.lastname.lower() + '@cs.local'
        values = {
            'email': email,
            'login': email,
            'partner_id': self.partner_id.id,
            'groups_id': [(6, 0, [])],
            'notify_email': 'none',
        }
        return res_users.create(values)

    @api.multi
    def _send_email(self):
        """ Never send invitation e-mails. """
        return True

## Instruction:
Fix bug, set notify_email to always after create portal user
## Code After:

from odoo import api, models
from odoo.tools import email_split


class PortalWizard(models.TransientModel):
    _inherit = 'portal.wizard'


class PortalUser(models.TransientModel):
    _inherit = 'portal.wizard.user'

    @api.multi
    def _create_user(self):
        """
        Override portal user creation to prevent sending e-mail to new user.
        """
        res_users = self.env['res.users'].with_context(
            noshortcut=True, no_reset_password=True)
        email = email_split(self.email)
        if email:
            email = email[0]
        else:
            email = self.partner_id.lastname.lower() + '@cs.local'
        values = {
            'email': email,
            'login': email,
            'partner_id': self.partner_id.id,
            'groups_id': [(6, 0, [])],
            'notify_email': 'none',
        }
        res = res_users.create(values)
        res.notify_email = 'always'
        return res

    @api.multi
    def _send_email(self):
        """ Never send invitation e-mails. """
        return True
