You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. # (c) 2015 Incaser Informatica S.L. - Sergio Teruel
  3. # (c) 2015 Incaser Informatica S.L. - Carlos Dauden
  4. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
  5. from openerp import models, api
  6. class WizardUser(models.TransientModel):
  7. _inherit = 'portal.wizard.user'
  8. @api.model
  9. def _send_email(self, wizard_user):
  10. # determine subject and body in the portal user's language
  11. user = self._retrieve_user(wizard_user)
  12. portal_url = user.partner_id.with_context(
  13. lang=user.lang,
  14. signup_force_type_in_url=''
  15. )._get_signup_url_for_action()[user.partner_id.id]
  16. user.partner_id.with_context(
  17. lang=user.lang, signup_force_type_in_url='').signup_prepare()
  18. template = self.env.ref(
  19. 'portal_welcome_email_template.portal_welcome_email')
  20. ctx = self.env.context.copy()
  21. ctx.update({
  22. 'login': user.login,
  23. 'portal_url': portal_url,
  24. 'db': self.env.cr.dbname,
  25. 'portal': wizard_user.wizard_id.portal_id.name,
  26. 'signup_url': user.signup_url,
  27. 'welcome_message': wizard_user.wizard_id.welcome_message or '',
  28. })
  29. return template.with_context(ctx).send_mail(user.id)