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.

20 lines
778 B

  1. # Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
  2. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
  3. from odoo import models, api
  4. from odoo.http import request
  5. class MailComposer(models.TransientModel):
  6. _inherit = 'mail.compose.message'
  7. @api.model
  8. def create(self, vals):
  9. """Workaround for https://github.com/odoo/odoo/pull/26589"""
  10. if 'website_id' not in self.env.context:
  11. website = request and hasattr(request, 'website') and request.website or None
  12. if not website:
  13. website = self.env['website'].get_current_website()
  14. if website:
  15. self = self.with_context(website_id=website.id)
  16. return super(MailComposer, self).create(vals)