콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5817 화면

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
45566
1
1월 25
1517
1
10월 23
2092
2
10월 23
2341
2
8월 23
4364