Browse Source

Merge branch '8.0' of /home/iii/addons-yelizariev/../mail_outgoing into 8.0

pull/1/head
Ildar Nasyrov 9 years ago
parent
commit
08350d2928
  1. 1
      mail_outgoing/__init__.py
  2. 20
      mail_outgoing/__openerp__.py
  3. 22
      mail_outgoing/mail_outgoing_models.py
  4. 34
      mail_outgoing/mail_outgoing_views.xml
  5. 3
      mail_outgoing/security/ir.model.access.csv
  6. 33
      mail_outgoing/security/mail_outgoing.xml
  7. BIN
      mail_outgoing/static/description/icon.png

1
mail_outgoing/__init__.py

@ -0,0 +1 @@
import mail_outgoing_models

20
mail_outgoing/__openerp__.py

@ -0,0 +1,20 @@
{
'name' : 'Outgoing mails menu',
'version' : '1.0.0',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category' : 'Social Network',
'website' : 'https://yelizariev.github.io',
'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/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'])]

34
mail_outgoing/mail_outgoing_views.xml

@ -0,0 +1,34 @@
<?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"/>
<field name="help" type="html">
<p>
Failed or delayed emails will be shown here. You will be able to retry failed emails and send delayed emails manually.
</p>
</field>
</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
mail_outgoing/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
mail_outgoing/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>

BIN
mail_outgoing/static/description/icon.png

After

Width: 100  |  Height: 100  |  Size: 2.1 KiB

Loading…
Cancel
Save