Odoo Help


How to return different view from a method?

Anirudh Lou
on 10/23/14, 4:40 AM 810 views

Hello every one, kindda lost here in this situation. I have my method, my aim is to return some view if some condition is meet. Here is the logic of what i made.

def my_method(self,cr,uid,ids,context=None):
  if some_var1 < some_var2:
        return {
                'type': 'ir.actions.act_window',
                'name': 'The Trial',
                'res_model': 'alphalist',
                'view_mode': 'tree',
                'res_id': my_record_tree1,
                'target': 'current',
                'nodestroy': False,
  elif some_var1 == some_var2:
         return {
                'type': 'ir.actions.act_window',
                'name': 'The Judges',
                'res_model': 'alphalist',
                'view_mode': 'tree',
                'res_id': my_record_tree2,
                'target': 'current',
                'nodestroy': False,

BUT, upon running nothing is bieng returned. Does any one can help/enlighten me. PLS!


Dércio Duvane
On 10/23/14, 5:11 AM

Hi, is this the whole snap of the code? If so, there's no else in your statement, which might be the reason why your are not getting a window!

i have put else, but still no view is bieng returned.

Anirudh Lou
on 1/22/15, 2:31 AM

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/23/14, 4:40 AM
Seen: 810 times
Last updated: 3/16/15, 8:10 AM