Browse Source

upload mail_outgoing

pull/1/head
Ivan Yelizariev 10 years ago
commit
e344a401fb
  1. 1
      __init__.py
  2. 19
      __openerp__.py
  3. 22
      mail_outgoing_models.py
  4. 29
      mail_outgoing_views.xml
  5. 3
      security/ir.model.access.csv
  6. 33
      security/mail_outgoing.xml

1
__init__.py

@ -0,0 +1 @@
import mail_outgoing_models

19
__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
}

22
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'])]

29
mail_outgoing_views.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="action_mail_outgoing" model="ir.actions.act_window">
<field name="name">Outgoing</field>
<field name="res_model">mail.mail</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{}</field>
<field name="search_view_id" ref="mail.view_mail_search"/>
</record>
<menuitem name="Outgoing" id="menu_mail_outgoing" parent="mail.mail_feeds" action="action_mail_outgoing" sequence="20"/>
<!-- After installation of the module, open the related menu -->
<record id="action_mail_outgoing_menu" model="ir.actions.client">
<field name="name">Open Outgoing Menu</field>
<field name="tag">reload</field>
<field name="params" eval="{'menu_id': ref('mail_outgoing.menu_mail_outgoing')}"/>
</record>
<record id="base.open_menu" model="ir.actions.todo">
<field name="action_id" ref="action_mail_outgoing_menu"/>
<field name="state">open</field>
</record>
</data>
</openerp>

3
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

33
security/mail_outgoing.xml

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="res.groups" id="group_all_emails">
<field name="name">all_emails</field>
<field name="comment">Gets access to all emails. For example to check outgoing emails.</field>
</record>
<record model="ir.rule" id="rule_mail_mail_user">
<field name="name">mail.mail: user</field>
<field name="model_id" ref="mail.model_mail_mail"/>
<field name="domain_force">[('author_id', '=', user.partner_id.id)]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="False"/>
<field name="global" eval="False"/>
</record>
<record model="ir.rule" id="rule_mail_mail_system">
<field name="name">mail.mail: system</field>
<field name="model_id" ref="mail.model_mail_mail"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('mail_outgoing.group_all_emails'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="True"/>
<field name="global" eval="False"/>
</record>
</data>
</openerp>
Loading…
Cancel
Save