2016-04-26 39 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 –