Browse Source

Merge pull request #31 from x620/mail-addons-8.0-res_partner_mails_count

[FIX] Mail addons 8.0 res partner mails count
pull/3/head
Ivan Yelizariev 9 years ago
parent
commit
b72044fb1d
  1. 1
      res_partner_mails_count/__init__.py
  2. 4
      res_partner_mails_count/__openerp__.py
  3. 20
      res_partner_mails_count/controllers.py
  4. 25
      res_partner_mails_count/demo.xml
  5. 2
      res_partner_mails_count/models.py
  6. 2
      res_partner_mails_count/security/ir.model.access.csv
  7. 15
      res_partner_mails_count/templates.xml
  8. 2
      res_partner_mails_count/tests/test_mail.py

1
res_partner_mails_count/__init__.py

@ -1,3 +1,2 @@
# -*- coding: utf-8 -*-
import controllers
import models

4
res_partner_mails_count/__openerp__.py

@ -28,8 +28,4 @@
'views/res_partner_mails_count.xml',
'templates.xml',
],
# only loaded in demonstration mode
'demo': [
'demo.xml',
],
}

20
res_partner_mails_count/controllers.py

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
from openerp import http
# class ResPartnerMailsCount(http.Controller):
# @http.route('/res_partner_mails_count/res_partner_mails_count/', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/res_partner_mails_count/res_partner_mails_count/objects/', auth='public')
# def list(self, **kw):
# return http.request.render('res_partner_mails_count.listing', {
# 'root': '/res_partner_mails_count/res_partner_mails_count',
# 'objects': http.request.env['res_partner_mails_count.res_partner_mails_count'].search([]),
# })
# @http.route('/res_partner_mails_count/res_partner_mails_count/objects/<model("res_partner_mails_count.res_partner_mails_count"):obj>/', auth='public')
# def object(self, obj, **kw):
# return http.request.render('res_partner_mails_count.object', {
# 'object': obj
# })

25
res_partner_mails_count/demo.xml

@ -1,25 +0,0 @@
<openerp>
<data>
<!-- -->
<!-- <record id="object0" model="res_partner_mails_count.res_partner_mails_count"> -->
<!-- <field name="name">Object 0</field> -->
<!-- </record> -->
<!-- -->
<!-- <record id="object1" model="res_partner_mails_count.res_partner_mails_count"> -->
<!-- <field name="name">Object 1</field> -->
<!-- </record> -->
<!-- -->
<!-- <record id="object2" model="res_partner_mails_count.res_partner_mails_count"> -->
<!-- <field name="name">Object 2</field> -->
<!-- </record> -->
<!-- -->
<!-- <record id="object3" model="res_partner_mails_count.res_partner_mails_count"> -->
<!-- <field name="name">Object 3</field> -->
<!-- </record> -->
<!-- -->
<!-- <record id="object4" model="res_partner_mails_count.res_partner_mails_count"> -->
<!-- <field name="name">Object 4</field> -->
<!-- </record> -->
<!-- -->
</data>
</openerp>

2
res_partner_mails_count/models.py

@ -11,7 +11,7 @@ class res_partner(models.Model):
@api.one
def _mails_to(self):
for r in self:
r.mails_to = self.env['mail.message'].sudo().search_count([('partner_ids', 'in', r.id)])
r.mails_to = self.env['mail.message'].sudo().search_count([('notified_partner_ids', 'in', r.id)])
@api.one
def _mails_from(self):

2
res_partner_mails_count/security/ir.model.access.csv

@ -1,2 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_res_partner_mails_count_res_partner_mails_count,res_partner_mails_count.res_partner_mails_count,model_res_partner_mails_count_res_partner_mails_count,,1,0,0,0

15
res_partner_mails_count/templates.xml

@ -9,6 +9,19 @@
type="text/javascript"></script>
</xpath>
</template>
<record id="search_notified_partner_ids" model="ir.ui.view">
<field name="name">mail.message.search.notified_partner</field>
<field name="model">mail.message</field>
<field name="priority">50</field>
<field name="inherit_id" ref="mail.view_message_search"/>
<field name="arch" type="xml">
<search string="Messages Search">
<field name="notified_partner_ids"/>
</search>
</field>
</record>
<record id="view_res_partner_mails_count_info_form" model="ir.ui.view">
<field name="name">res.partner.mails.count</field>
<field name="model">res.partner</field>
@ -18,7 +31,7 @@
<xpath expr="//div[@name='buttons']" position="inside">
<button class="oe_inline oe_stat_button" type="action"
name="%(action_mails)d"
context="{'search_default_partner_ids': [active_id], 'default_model': 'res.partner', 'default_res_id': active_id}"
context="{'search_default_notified_partner_ids': [active_id], 'default_model': 'res.partner', 'default_res_id': active_id}"
icon="fa-envelope">
<field string="Mails to" name="mails_to" widget="statinfo"/>
</button>

2
res_partner_mails_count/tests/test_mail.py

@ -13,8 +13,6 @@ class test_message_count(TransactionCase):
compose = mail_compose.with_context(
{
'default_composition_mode': 'comment',
'default_model': 'res.partner',
'default_res_id': new_partner1.id,
}).create(
{
'subject': 'test subj',

Loading…
Cancel
Save