Browse Source

Merge pull request #69 from yelizariev/9.0-merge-398e5ef

9.0 merge 398e5ef
pull/28/merge
Ivan Yelizariev 8 years ago
committed by GitHub
parent
commit
839a81de4f
  1. 6
      res_partner_company_messages/README.rst
  2. 2
      res_partner_company_messages/__init__.py
  3. 17
      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. 19
      res_partner_company_messages/models.py
  7. BIN
      res_partner_company_messages/static/description/icon.png
  8. 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 9.0 c8cd67c5d98b410cabe0a6efb3347a8a4de731d8

2
res_partner_company_messages/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

17
res_partner_company_messages/__openerp__.py

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
{
'name': "Aggregate messages from company's contacts",
'version': '1.0.0',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'LGPL-3',
"price": 70.00,
"currency": "EUR",
'category': 'Discuss',
'website': 'https://twitter.com/yelizariev',
'images': ['images/child.png', 'images/parent.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

19
res_partner_company_messages/models.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from openerp import api
from openerp import models
class Partner(models.Model):
_inherit = 'res.partner'
@api.multi
def read(self, fields=None, load='_classic_read'):
res = super(Partner, self).read(fields=fields, load=load)
if fields and 'message_ids' in fields:
for vals in res:
partner = self.browse(vals['id'])
if not partner.is_company:
continue
domain = [('model', '=', 'res.partner'), ('res_id', 'in', [partner.id] + partner.child_ids.ids)]
vals['message_ids'] = self.env['mail.message'].search(domain).ids
return res

BIN
res_partner_company_messages/static/description/icon.png

After

Width: 100  |  Height: 100  |  Size: 3.0 KiB

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