Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
5679 Переглядів

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

Аватар
Відмінити
Найкраща відповідь

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 ?

Related Posts Відповіді Переглядів Дія
3
лист. 24
45428
1
січ. 25
1341
1
жовт. 23
1991
2
жовт. 23
2194
2
серп. 23
4215