Skip to Content
Menu
This question has been flagged

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

Avatar
Discard
Related Posts Replies Views Activity
2
Jan 21
3111
0
Oct 18
2360
1
Jun 16
3579
1
Nov 24
106
1
Dec 22
1187