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

I suspect that I am using old API in this code block:

Model = request.registry['stock.picking']
cr, uid, context = request.cr, request.uid, request.context
fields = [ 'id' ]
current_stock_picking = Model.read(cr, uid, [int(id)], fields, context)[0]['id']


Which would be the equivalent in API 8?

The code is included in a controller, should I use any decorator for using API 8?


아바타
취소
베스트 답변

Just change it to:

env['stock.picking'].read([int(id)], fields)[0]['id']

The values of the fields list should be other than 'id', because the field id it will always returned in the dict of result for a given id and also you have it in the var id

아바타
취소
작성자

I tried and it does not work. It returns an empty list.

작성자 베스트 답변

Thanks Axel,

I do 

env = Env(cr, uid, context)

to get env.

Any possibility to use directly env? (I am using it inside a controller)

아바타
취소

solved then?

관련 게시물 답글 화면 활동
6
2월 16
7620
2
2월 22
5570
2
9월 15
4623
0
5월 15
3115
1
7월 18
3798