diff --git a/base_usability/__init__.py b/base_usability/__init__.py index 101105a..75c4381 100644 --- a/base_usability/__init__.py +++ b/base_usability/__init__.py @@ -1,23 +1,4 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Base Usability module for Odoo -# Copyright (C) 2014-2015 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# -*- coding: utf-8 -*- from . import partner +from . import mail diff --git a/base_usability/mail.py b/base_usability/mail.py new file mode 100644 index 0000000..a9cd095 --- /dev/null +++ b/base_usability/mail.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Base Usability module for Odoo +# Copyright (C) 2015 Akretion (http://www.akretion.com/) +# @author: Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models +import logging + +logger = logging.getLogger(__name__) + + +class IrMailServer(models.Model): + _inherit = "ir.mail_server" + + def send_email( + self, cr, uid, message, mail_server_id=None, smtp_server=None, + smtp_port=None, smtp_user=None, smtp_password=None, + smtp_encryption=None, smtp_debug=False, context=None): + + logger.info("Sending email to %s copy %s with subject %s", + message.get('To'), + message.get('Cc'), + message.get('Subject')) + return super(IrMailServer, self).send_email( + cr, uid, message, mail_server_id=mail_server_id, + smtp_server=smtp_server, smtp_port=smtp_port, + smtp_user=smtp_user, smtp_password=smtp_password, + smtp_encryption=smtp_encryption, smtp_debug=smtp_debug, + context=context)