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.

22 lines
858 B

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp.addons.mass_mailing.controllers.main import MassMailController
  5. from openerp.http import request, route
  6. class MassMailingPartner(MassMailController):
  7. @route()
  8. def is_subscriber(self, *args, **kwargs):
  9. """Get user name too."""
  10. result = super(MassMailingPartner, self).is_subscriber(*args, **kwargs)
  11. email = result.get("email") or ""
  12. if request.website.user_id != request.env.user:
  13. name = request.env.user.name
  14. else:
  15. name, email = (request.env["mail.mass_mailing.contact"]
  16. .get_name_email(email, context=request.context))
  17. result["name"] = name
  18. result["email"] = email
  19. return result