Add "All Messages Except Notifications" for notify_email on res.partner
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Mail Usability',
|
'name': 'Mail Usability',
|
||||||
'version': '0.1',
|
'version': '8.0.1.0.0',
|
||||||
'category': 'Base',
|
'category': 'Base',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'summary': 'Usability improvements on mails',
|
'summary': 'Usability improvements on mails',
|
||||||
@@ -37,6 +37,7 @@ Small usability improvements on mails:
|
|||||||
|
|
||||||
* remove 'sent by' in notification footer
|
* remove 'sent by' in notification footer
|
||||||
|
|
||||||
|
* add a new entry *All Messages Except Notifications* to the field *Receive Inbox Notifications by Email* of partners (becomes the default value)
|
||||||
""",
|
""",
|
||||||
'author': 'Akretion',
|
'author': 'Akretion',
|
||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
|
|||||||
@@ -20,7 +20,16 @@
|
|||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp import models, api
|
from openerp import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class ResPartner(models.Model):
|
||||||
|
_inherit = 'res.partner'
|
||||||
|
|
||||||
|
notify_email = fields.Selection(
|
||||||
|
selection_add=[
|
||||||
|
('all_except_notification', 'All Messages Except Notifications')],
|
||||||
|
default='all_except_notification')
|
||||||
|
|
||||||
|
|
||||||
class MailMail(models.Model):
|
class MailMail(models.Model):
|
||||||
@@ -50,3 +59,15 @@ class MailNotification(models.Model):
|
|||||||
footer = footer[:footer.find('\n<br /><small>Sent by ')]
|
footer = footer[:footer.find('\n<br /><small>Sent by ')]
|
||||||
footer = footer[:footer.find(u'\n<br /><small>Envoyé par ')]
|
footer = footer[:footer.find(u'\n<br /><small>Envoyé par ')]
|
||||||
return footer
|
return footer
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def get_partners_to_email(self, message):
|
||||||
|
notify_pids = super(MailNotification, self).get_partners_to_email(
|
||||||
|
message)
|
||||||
|
for notif in self:
|
||||||
|
if (
|
||||||
|
message.type == 'notification' and
|
||||||
|
notif.partner_id.notify_email ==
|
||||||
|
'all_except_notification'):
|
||||||
|
notify_pids.remove(notif.partner_id.id)
|
||||||
|
return notify_pids
|
||||||
|
|||||||
Reference in New Issue
Block a user