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.

2

How to return different view from a method?

By
Anirudh Lou
on 10/23/14, 4:40 AM 725 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):
  some_var1
  some_var2
  ...
  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!

















 

0
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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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