Browse Source

[IMP]GOLEM : allow force email sender

master
Fabien BOURGEOIS 7 months ago
parent
commit
f695e36811
2 changed files with 22 additions and 3 deletions
  1. +1
    -1
      golem_base/__manifest__.py
  2. +21
    -2
      golem_base/models/ir_mail_server.py

+ 1
- 1
golem_base/__manifest__.py View File

@ -19,7 +19,7 @@
{
'name': 'GOLEM base module for global dependencies',
'summary': 'GOLEM base installs base and shared dependencies for GOLEM',
'version': '10.0.1.1.1',
'version': '10.0.1.1.2',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',


+ 21
- 2
golem_base/models/ir_mail_server.py View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2018-2020 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -21,8 +21,27 @@ from odoo import models, fields
class IrMailServer(models.Model):
"""IR Mail Server fix for >64 characters pass """
""" IR Mail Server adaptations """
_inherit = 'ir.mail_server'
# IR Mail Server fix for >64 characters pass
smtp_user = fields.Char(size=100)
smtp_pass = fields.Char(size=100)
def build_email(self, email_from, email_to, subject, body, email_cc=None,
email_bcc=None, reply_to=False, attachments=None,
message_id=None, references=None, object_id=False,
subtype='plain', headers=None, body_alternative=None,
subtype_alternative='plain'):
""" Overwrite to supercharge from_to """
get_param = self.env['ir.config_parameter'].sudo().get_param
force_email_from = get_param('mail.force.email_from', email_from)
if force_email_from != email_from:
email_from = force_email_from
reply_to = force_email_from
msg = super(IrMailServer, self).build_email(
email_from, email_to, subject, body, email_cc, email_bcc,
reply_to, attachments, message_id, references, object_id, subtype,
headers, body_alternative, subtype_alternative
)
return msg

Loading…
Cancel
Save