[IMP] add readme, remove auto following when sending an email, use light version of email notification to avoid injecting useless link in the mail sent
This commit is contained in:
10
mail_usability/README.rst
Normal file
10
mail_usability/README.rst
Normal file
@@ -0,0 +1,10 @@
|
||||
# Mail Usability
|
||||
|
||||
Take back the control on your email
|
||||
|
||||
## Feature
|
||||
|
||||
- do not follow automatically a object when sending an email
|
||||
- add the option 'All Messages Except Notifications' on partner and use it by default to avoid sending unwanted mail to partner
|
||||
- better email preview, allow to select between the whole database object and not only the last 10
|
||||
- use a light template version for notification without link (link should be explicit)
|
||||
@@ -25,6 +25,9 @@ Small usability improvements on mails:
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['mail'],
|
||||
'data': ['mail_view.xml'],
|
||||
'data': [
|
||||
'mail_view.xml',
|
||||
'mail_data.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -42,6 +42,17 @@ class ResPartner(models.Model):
|
||||
send_after_commit=send_after_commit,
|
||||
user_signature=user_signature)
|
||||
|
||||
def _notify_by_email(
|
||||
self, message, force_send=False, send_after_commit=True,
|
||||
user_signature=True):
|
||||
if not self._context.get('custom_layout'):
|
||||
self = self.with_context(
|
||||
custom_layout='mail_usability.mail_template_notification')
|
||||
return super(ResPartner, self)._notify_by_email(
|
||||
message, force_send=force_send,
|
||||
send_after_commit=send_after_commit,
|
||||
user_signature=user_signature)
|
||||
|
||||
|
||||
class TemplatePreview(models.TransientModel):
|
||||
_inherit = "email_template.preview"
|
||||
@@ -79,3 +90,20 @@ class TemplatePreview(models.TransientModel):
|
||||
self._context['template_id'])
|
||||
template.send_mail(
|
||||
self.res_id, force_send=True, raise_exception=True)
|
||||
|
||||
|
||||
class MailThread(models.AbstractModel):
|
||||
_inherit = 'mail.thread'
|
||||
|
||||
@api.multi
|
||||
@api.returns('self', lambda value: value.id)
|
||||
def message_post(self, body='', subject=None, message_type='notification',
|
||||
subtype=None, parent_id=False, attachments=None,
|
||||
content_subtype='html', **kwargs):
|
||||
# Do not implicitly follow an object by just sending a message
|
||||
return super(MailThread,
|
||||
self.with_context(mail_create_nosubscribe=True)
|
||||
).message_post(
|
||||
body=body, subject=subject, message_type=message_type,
|
||||
subtype=subtype, parent_id=parent_id, attachments=attachments,
|
||||
content_subtype=content_subtype, **kwargs)
|
||||
|
||||
15
mail_usability/mail_data.xml
Normal file
15
mail_usability/mail_data.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<!--Default Notification Email template -->
|
||||
<record id="mail_template_notification" model="mail.template">
|
||||
<field name="name">Notification Email</field>
|
||||
<field name="subject">${object.subject}</field>
|
||||
<field name="model_id" ref="mail.model_mail_message"/>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
<field name="body_html">${object.body | safe}</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user