Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5663 มุมมอง

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
45417
1
ม.ค. 25
1321
1
ต.ค. 23
1977
"Wrong value for %s: %r" % (self, value) แก้ไขแล้ว
2
ต.ค. 23
2178
2
ส.ค. 23
4202