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
794 B

  1. # Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
  2. # License MIT (https://opensource.org/licenses/MIT).
  3. from odoo import api, models
  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 = (
  12. request and hasattr(request, "website") and request.website or None
  13. )
  14. if not website:
  15. website = self.env["website"].get_current_website()
  16. if website:
  17. self = self.with_context(website_id=website.id)
  18. return super(MailComposer, self).create(vals)