如何在 odoo 9 中查看旧消息?
How to view old messages in odoo 9?
在 odoo 8 中有一个名为存档的菜单,其中显示已读消息,但在 odoo 9 中没有这样的东西。
有谁知道如何查看已读消息或使用过滤器使其成为可能。以及发送头像也不显示。
查看ODOO9中的消息完成这些步骤:
- 激活 开发者模式 .
- 转到设置-> 技术-> 电子邮件->Message .
在消息菜单中您可以找到所有消息的列表。
希望这对您有所帮助。
从我的角度来看,存档 function/field 不再存在于 odoo v9 中。在 Odoo 8 中,该字段称为 'to_read'。不知何故,阅读的消息在 V9 中被取消链接,但我不知道如何。其他人也不知道:
https://www.odoo.com/de_DE/forum/hilfe-1/question/odoo-9-archives-messages-92788
我自己做了一些研究。我找到了一种将邮件保存在收件箱文件夹中但隐藏的方法。这是我的方法。
我在 mail.message 中创建了一个活动字段和自定义过滤器,并覆盖了 set_message_done 方法,如下所示。
@api.multi
def set_message_done(self, partner_ids=None):
""" Remove the needaction from messages for the current partner. """
partner_id = self.env.user.partner_id
self.active = False
messages = self.filtered(lambda msg: partner_id in msg.needaction_partner_ids)
if not len(messages):
return
#messages.sudo().write({'needaction_partner_ids': [(3, partner_id.id)]})
# notifies changes in messages through the bus. To minimize the number of
# notifications, we need to group the messages depending on their channel_ids
groups = []
current_channel_ids = messages[0].channel_ids
current_group = []
for record in messages:
if record.channel_ids == current_channel_ids:
current_group.append(record.id)
else:
groups.append((current_group, current_channel_ids))
current_group = [record.id]
current_channel_ids = record.channel_ids
groups.append((current_group, current_channel_ids))
current_group = [record.id]
current_channel_ids = record.channel_ids
for (msg_ids, channel_ids) in groups:
notification = {'type': 'mark_as_read', 'message_ids': msg_ids, 'channel_ids': [c.id for c in channel_ids]}
self.env['bus.bus'].sendone((self._cr.dbname, 'res.partner', partner_id.id), notification)
总结:我评论了写入行并添加 self.active = false。因此该方法将隐藏消息而不是将其删除。但仍然有消息未读计数气泡。
然后我覆盖 res.partner 中的 get_needaction_count 并添加一个简单的逻辑。
@api.model
def get_needaction_count(self):
""" compute the number of needaction of the current user """
if self.env.user.partner_id:
id = []
active_msg = self.env['mail.message'].search([('active','=',True)])
for x in active_msg:
for rec in x.partner_ids:
id += [rec.id]
if self.env.user.partner_id in id:
return len(active_msg)
_logger.error('Call to needaction_count without partner_id')
return 0
最后有一个模块可以恢复存档:
https://www.odoo.com/apps/modules/9.0/mail_archives/
但不是免费的!
注意:
It-Projects LLC 还有其他新模块来改进 odoo 9 中的 mail/messaging。
在 odoo 8 中有一个名为存档的菜单,其中显示已读消息,但在 odoo 9 中没有这样的东西。
有谁知道如何查看已读消息或使用过滤器使其成为可能。以及发送头像也不显示。
查看ODOO9中的消息完成这些步骤:
- 激活 开发者模式 .
- 转到设置-> 技术-> 电子邮件->Message .
在消息菜单中您可以找到所有消息的列表。
希望这对您有所帮助。
从我的角度来看,存档 function/field 不再存在于 odoo v9 中。在 Odoo 8 中,该字段称为 'to_read'。不知何故,阅读的消息在 V9 中被取消链接,但我不知道如何。其他人也不知道: https://www.odoo.com/de_DE/forum/hilfe-1/question/odoo-9-archives-messages-92788
我自己做了一些研究。我找到了一种将邮件保存在收件箱文件夹中但隐藏的方法。这是我的方法。
我在 mail.message 中创建了一个活动字段和自定义过滤器,并覆盖了 set_message_done 方法,如下所示。
@api.multi
def set_message_done(self, partner_ids=None):
""" Remove the needaction from messages for the current partner. """
partner_id = self.env.user.partner_id
self.active = False
messages = self.filtered(lambda msg: partner_id in msg.needaction_partner_ids)
if not len(messages):
return
#messages.sudo().write({'needaction_partner_ids': [(3, partner_id.id)]})
# notifies changes in messages through the bus. To minimize the number of
# notifications, we need to group the messages depending on their channel_ids
groups = []
current_channel_ids = messages[0].channel_ids
current_group = []
for record in messages:
if record.channel_ids == current_channel_ids:
current_group.append(record.id)
else:
groups.append((current_group, current_channel_ids))
current_group = [record.id]
current_channel_ids = record.channel_ids
groups.append((current_group, current_channel_ids))
current_group = [record.id]
current_channel_ids = record.channel_ids
for (msg_ids, channel_ids) in groups:
notification = {'type': 'mark_as_read', 'message_ids': msg_ids, 'channel_ids': [c.id for c in channel_ids]}
self.env['bus.bus'].sendone((self._cr.dbname, 'res.partner', partner_id.id), notification)
总结:我评论了写入行并添加 self.active = false。因此该方法将隐藏消息而不是将其删除。但仍然有消息未读计数气泡。
然后我覆盖 res.partner 中的 get_needaction_count 并添加一个简单的逻辑。
@api.model
def get_needaction_count(self):
""" compute the number of needaction of the current user """
if self.env.user.partner_id:
id = []
active_msg = self.env['mail.message'].search([('active','=',True)])
for x in active_msg:
for rec in x.partner_ids:
id += [rec.id]
if self.env.user.partner_id in id:
return len(active_msg)
_logger.error('Call to needaction_count without partner_id')
return 0
最后有一个模块可以恢复存档: https://www.odoo.com/apps/modules/9.0/mail_archives/ 但不是免费的!
注意: It-Projects LLC 还有其他新模块来改进 odoo 9 中的 mail/messaging。