跳至內容
選單
此問題已被標幟
1 回覆
5491 瀏覽次數

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 ?

相關帖文 回覆 瀏覽次數 活動
3
11月 24
45182
1
1月 25
1166
1
10月 23
1791
2
10月 23
2036
2
8月 23
4012