Browse Source

res_partner_company_messages

pull/77/head
Ivan Yelizariev 10 years ago
committed by Ivan Yelizariev
parent
commit
b6ac814b02
  1. 6
      res_partner_company_messages/README.rst
  2. 1
      res_partner_company_messages/__init__.py
  3. 13
      res_partner_company_messages/__openerp__.py
  4. BIN
      res_partner_company_messages/images/child.png
  5. BIN
      res_partner_company_messages/images/parent.png
  6. 15
      res_partner_company_messages/models.py
  7. 3
      res_partner_company_messages/views.xml

6
res_partner_company_messages/README.rst

@ -0,0 +1,6 @@
Aggregate messages from company's contacts
==========================================
By default, odoo displays under partner form only its own messages. The module shows under company form both their own messages and the messages of any contacts attached to that company.
Tested on Odoo 8.0 ea60fed97af1c139e4647890bf8f68224ea1665b

1
res_partner_company_messages/__init__.py

@ -0,0 +1 @@
import models

13
res_partner_company_messages/__openerp__.py

@ -0,0 +1,13 @@
{
'name': "Aggregate messages from company's contacts",
'version': '1.0.0',
'author': 'Ivan Yelizariev',
'category': 'Custom',
'website': 'https://yelizariev.github.io',
'images': ['images/parent.png', 'images/child.png'],
'depends': ['mail'],
'data': [
'views.xml',
],
'installable': True
}

BIN
res_partner_company_messages/images/child.png

After

Width: 812  |  Height: 588  |  Size: 50 KiB

BIN
res_partner_company_messages/images/parent.png

After

Width: 811  |  Height: 583  |  Size: 67 KiB

15
res_partner_company_messages/models.py

@ -0,0 +1,15 @@
from openerp import api, models, fields, SUPERUSER_ID
class mail_message(models.Model):
_inherit = 'mail.message'
@api.cr_uid_context
def message_read(self, cr, uid, ids=None, domain=None, message_unload_ids=None,
thread_level=0, context=None, parent_id=False, limit=None):
if context and context.get('default_model') == 'res.partner':
partner = self.pool['res.partner'].browse(cr, uid, context.get('default_res_id'))
domain_by_id = domain and len(domain) == 1 and domain[0][0] == 'id' and domain[0][1] == '='
if partner.is_company and not domain_by_id:
ids = None
domain = [('model', '=', 'res.partner'), ('res_id', 'in', [partner.id]+partner.child_ids.ids)]
return super(mail_message, self).message_read(cr, uid, ids, domain, message_unload_ids, thread_level, context, parent_id, limit)

3
res_partner_company_messages/views.xml

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp><data>
</data></openerp>
Loading…
Cancel
Save