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

How to get Default object state dynamicaly using a method [v7]

By
Yassine TEIMI
on 2/3/15, 11:47 AM 528 views

On sale.order object for example, on the defaults dictionnary, We can see : 

default = {

'state': draft

}

I want to do it but dynamicaly, for that, I should use a method defined before columns dictionnary. So, let's say my method is called _get_default_state. The main reason why I decided to create this function, is that i have two views for the same object, and I want that for every view, a different default state is loaded when trying to create a record. So, the two views will no longer share the same default state.

So, the function will be like that : 

IF actual_view_id == ref1 : 

  return draft_quotation

ELIF actual_view_id == ref2:

 return draft

The problem is I don't know how to get the actual view reference, and pass it to the method.

Is there any other way to perform this kind of need ?

 

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: 2/3/15, 11:47 AM
Seen: 528 times
Last updated: 3/16/15, 8:10 AM