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

I have a problem: I need to manually enter 2 fields' requested_document 'on sale.order and on sale.order.line, I want to enter the value for' 'requested_document' on each line of sale.order.line itself I have related them but the problem is related for not edit, I tried

         def _default_requested_document (self):

             if self.context.get ('active_model') == 'sale.order':

                 return self.context.get ('active_id', False)

         requested_document = fields.Text ('Requested Document', default = _default_requested_document) but failed.

아바타
취소
베스트 답변

Hi Paul,

i think there is a problem in context getting,

You can get context using:

self.env.context or self._context 

To get context value:

self.env.context.get('active_model') or self._context.get('active_model')

other code are perfect.

Accept and upvote answer if helpful..

Thank you


아바타
취소
관련 게시물 답글 화면 활동
2
1월 23
2551
1
8월 22
5538
0
12월 18
5429
1
3월 15
5166
1
2월 23
1997