2016-04-26 36 views
0

在odoo 8中有一个叫做档案的菜单,在那里读取消息出现,但在odoo 9中没有这样的事情。
是否有人知道如何查看读取消息或使用过滤器进行设置。以及发送头像也不显示。如何查看odoo 9中的旧消息?

回答

0

我做了一些我自己的研究。我发现了一种将邮件保留在收件箱文件夹中但隐藏的方法。这是我的方法。

我在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 
1

对于通过这些步骤在观看转到ODOO9消息:

  1. 激活的开发模式
  2. 转到设置 - >技术 - >电子邮件 - >Message

消息菜单中,您可以找到所有消息的列表。

希望这可以帮助你。

+0

所以这是管理员工应该如何看自己的旧消息 –

+0

用户可以使用自定义过滤器开此链接: - > http://prntscr.com/awzyof – prakash

+0

不显示。 https://www.dropbox.com/sh/5gv2xr9v4x7q2o6/AACO6agOs-dQZkWb5BrgRYcCa?dl=0 –