[IMP]GOLEM : allow force email sender
This commit is contained in:
parent
0434781cd0
commit
f695e36811
@ -19,7 +19,7 @@
|
|||||||
{
|
{
|
||||||
'name': 'GOLEM base module for global dependencies',
|
'name': 'GOLEM base module for global dependencies',
|
||||||
'summary': 'GOLEM base installs base and shared dependencies for GOLEM',
|
'summary': 'GOLEM base installs base and shared dependencies for GOLEM',
|
||||||
'version': '10.0.1.1.1',
|
'version': '10.0.1.1.2',
|
||||||
'category': 'GOLEM',
|
'category': 'GOLEM',
|
||||||
'author': 'Fabien Bourgeois',
|
'author': 'Fabien Bourgeois',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# 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):
|
class IrMailServer(models.Model):
|
||||||
"""IR Mail Server fix for >64 characters pass """
|
""" IR Mail Server adaptations """
|
||||||
_inherit = 'ir.mail_server'
|
_inherit = 'ir.mail_server'
|
||||||
|
|
||||||
|
# IR Mail Server fix for >64 characters pass
|
||||||
smtp_user = fields.Char(size=100)
|
smtp_user = fields.Char(size=100)
|
||||||
smtp_pass = 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…
Reference in New Issue
Block a user