You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
680 B
19 lines
680 B
from openerp import models
|
|
|
|
|
|
class Partner(models.Model):
|
|
_inherit = "res.partner"
|
|
|
|
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
|