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.

16 lines
547 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 fields, models
  4. class Message(models.Model):
  5. _inherit = "mail.message"
  6. def _default_mail_server_id(self):
  7. website = self.env.context.get("website_id")
  8. if not website:
  9. return
  10. website = self.env["website"].sudo().browse(website)
  11. return website.mail_server_id.id
  12. mail_server_id = fields.Many2one(default=_default_mail_server_id)