跳至内容
菜单
此问题已终结

Hello,

I have one problem, when we are in Project (project.project) view there have documents ,tasks, as a Button. and it also have the count. When we are click on Document its re direct to the view of document . and shows the no of document that related to the particular project .When i check the base code of project, i found they are created on python function to redirecting the view they given the name as attachment_tree_view, and they create another function for counting the number of document. Now my problem is that i need similar button as Inbox , and when i click on that it should gone to the (settings ->mail ->messages of that project), Is it possible to do?? i try to do that but i got error when i am trying to solve that, 

My code

def inbox_tree_view(self, cr, uid, ids, context):

 message_ids = self.pool.get('mail.message').search(cr, uid, [('parent_id', 'in', ids)])

domain = [
'|',
'&', ('res_model', '=', 'project.project'), ('res_id', 'in',[1]),
'&', ('res_model', '=', 'mail.message'), ('res_id', 'in', [51])]
res_id = ids and ids[0] or False
print"ppppppppppppppppppp",self._name, res_id
return {
'name': _('Message'),
'domain': domain,
'res_model': 'mail.message',
'type': 'ir.actions.act_window',
'view_id': False,
'view_mode': 'tree,form',
'view_type': 'form',
'limit': 80,
'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id)
}



Thanks,

Logicious

形象
丢弃
相关帖文 回复 查看 活动
2
1月 21
4111
0
10月 18
3044
1
6月 16
4461
1
11月 24
1864
1
12月 22
2274