commit e344a401fbb5522d22575c15f0376972f2144412 Author: Ivan Yelizariev Date: Wed Jan 21 13:33:40 2015 +0200 upload mail_outgoing diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..698570a --- /dev/null +++ b/__init__.py @@ -0,0 +1 @@ +import mail_outgoing_models diff --git a/__openerp__.py b/__openerp__.py new file mode 100644 index 0000000..1ac15ee --- /dev/null +++ b/__openerp__.py @@ -0,0 +1,19 @@ +{ + 'name' : 'Outgoing mails menu', + 'version' : '1.0.0', + 'author' : 'Ivan Yelizariev', + 'category' : 'Sale', + 'website' : 'https://it-projects.info', + 'description': """ +Allows to check outgoing mails, i.e. failed or delayed. + +Tested on Odoo 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d + """, + 'depends' : ['mail'], + 'data':[ + 'security/mail_outgoing.xml', + 'security/ir.model.access.csv', + 'mail_outgoing_views.xml', + ], + 'installable': True +} diff --git a/mail_outgoing_models.py b/mail_outgoing_models.py new file mode 100644 index 0000000..a823bbc --- /dev/null +++ b/mail_outgoing_models.py @@ -0,0 +1,22 @@ +from openerp.osv import osv + +class mail_message(osv.Model): + _inherit = 'mail.message' + + def check_access_rule(self, cr, uid, ids, operation, context=None): + group_all_emails = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, 'mail_outgoing.group_all_emails', context=context) + + user = self.pool['res.users'].browse(cr, uid, uid, context) + user_groups = set(user.groups_id) + if user_groups.issuperset(group_all_emails): + return + + return super(mail_message, self).check_access_rule(cr, uid, ids, operation, context) + +class mail_mail(osv.Model): + _name = 'mail.mail' + _inherit = ['mail.mail', 'ir.needaction_mixin'] + _needaction = True + + def _needaction_domain_get(self, cr, uid, context=None): + return [('state','in', ['outgoing', 'exception'])] diff --git a/mail_outgoing_views.xml b/mail_outgoing_views.xml new file mode 100644 index 0000000..9667288 --- /dev/null +++ b/mail_outgoing_views.xml @@ -0,0 +1,29 @@ + + + + + + Outgoing + mail.mail + form + tree,form + {} + + + + + + + + Open Outgoing Menu + reload + + + + + open + + + + + diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv new file mode 100644 index 0000000..9ae9ee1 --- /dev/null +++ b/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_mail_mail_system,mail.mail.system,model_mail_mail,mail_outgoing.group_all_emails,1,1,1,1 + diff --git a/security/mail_outgoing.xml b/security/mail_outgoing.xml new file mode 100644 index 0000000..b394494 --- /dev/null +++ b/security/mail_outgoing.xml @@ -0,0 +1,33 @@ + + + + + all_emails + Gets access to all emails. For example to check outgoing emails. + + + + mail.mail: user + + [('author_id', '=', user.partner_id.id)] + + + + + + + + + + mail.mail: system + + [(1, '=', 1)] + + + + + + + + +