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

In odoo context dictionary is frozen so no one can update it, for that one solution is also available is calling method using with_context.


ctx = self.env.context.copy()

ctx.update({'additional_parameter' : value})

self.with_context(ctx).methodname()


but when we use the same pattern to call super method then result turns into the infinite call.


ctx = self.env.context.copy()

ctx.update({'additional_parameter' : value})

super(product_product, self).with_context(ctx).create(vals)


Any help will be highly appreciated.

아바타
취소
베스트 답변

super(product_product, self.with_context(ctx)).create(vals)

아바타
취소
베스트 답변

hi,

i've had the same problem on odoo9 (and i assume it will be the same in odoo 10+). Simple solution for this - add an other parameter 'i_was_already_here': True to the context - in the same function do check for this paramter at the start - if it does exists - then the context already got updated - and you can call the super call without the context update. So you wont get the infinite loop

아바타
취소
관련 게시물 답글 화면 활동
16
8월 19
10019
1
1월 19
5263
5
6월 18
10662
0
9월 17
2367
0
2월 17
2881