Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Redirecting view Similar case of Document

By
Logicious
on 9/11/15, 8:30 AM 375 views

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/11/15, 8:30 AM
Seen: 375 times
Last updated: 9/11/15, 8:30 AM