diff --git a/mail_usability/__init__.py b/mail_usability/__init__.py new file mode 100644 index 0000000..b910c1b --- /dev/null +++ b/mail_usability/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Mail Usability module for Odoo +# Copyright (C) 2016 Akretion (http://www.akretion.com) +# @author Benoît Guillot +# +# 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 . import mail diff --git a/mail_usability/__openerp__.py b/mail_usability/__openerp__.py new file mode 100644 index 0000000..3be53b1 --- /dev/null +++ b/mail_usability/__openerp__.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Mail Usability module for Odoo +# Copyright (C) 2016 Akretion (http://www.akretion.com) +# @author Benoît Guillot +# +# 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 . +# +############################################################################## + + +{ + 'name': 'Mail Usability', + 'version': '0.1', + 'category': 'Base', + 'license': 'AGPL-3', + 'summary': 'Usability improvements on mails', + 'description': """ +Mail Usability +============== + +Small usability improvements on mails: + +* remove link in mail footer + +* remove 'sent by' in notification footer + + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['mail'], + 'data': [], + 'installable': True, +} diff --git a/mail_usability/mail.py b/mail_usability/mail.py new file mode 100644 index 0000000..ded5f5f --- /dev/null +++ b/mail_usability/mail.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Mail Usability module for Odoo +# Copyright (C) 2016 Akretion (http://www.akretion.com) +# @author Benoît Guillot +# +# 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, api + + +class MailMail(models.Model): + _inherit = 'mail.mail' + + @api.model + def send_get_mail_body(self, mail, partner=None): + """ + Avoid unwanted links in mail footer. + """ + return mail.body_html + + +class MailNotification(models.Model): + _inherit = 'mail.notification' + + @api.cr_uid_id_context + def get_signature_footer( + self, cr, uid, user_id, res_model=None, res_id=None, context=None, + user_signature=True): + """ + Remove : "Sent by 'Your Company' using Odoo" from signature. + """ + footer = super(MailNotification, self).get_signature_footer( + cr, uid, user_id, res_model=res_model, res_id=res_id, + context=context, user_signature=user_signature) + footer = footer[:footer.find('\n\n
Sent by ')] + footer = footer[:footer.find(u'\n\n
Envoyé par ')] + return footer