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

Change context with self (v8)

By
Denis Roussel
on 2/11/15, 10:07 AM 992 views

Hi,

 

I'm facing diffuclties to change context especially on self (I don't know however if it is possible...).

I've read documentation but in my case I want to pass a different context between two onchange functions (@api.onchange).

Can somebody give me an example ?

 

Many thanks

0
yopi
On 2/16/15, 11:25 PM

Hi,

You can modify the current context with with_context function, 

example: self.env['object.model'].with_context('Put your new context here').create(values)

I know that syntax but it will make operations with your context on a 'new' recordset (self.env['object.model']). What we want is when you are in a function 'a_function(self)' and call 'another_function(self)' in the same model (in an inherited module or not), we want to add features to current context. We call obviously the function like : def a_function(self): (...) self.another_function() Is it possible ?

Denis Roussel
on 2/17/15, 5:57 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: 2/11/15, 10:07 AM
Seen: 992 times
Last updated: 3/16/15, 8:10 AM