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

How to get dictionary from product?

                        models_ids = self.env['product.template'].search([('id', '=', rule.product_id.id)])

                        my_dict = dict(models_ids)

example:

my_dict = {'id': 3, 'type': consu, 'categ_id': 1 ...e.t.c}

아바타
취소
베스트 답변

Hope this helps you 


prod_obj = self.env['product.template']
models_ids = self.env['product.template'].search([('id', '=', rule.product_id.id)])
for model in models_ids:
new_dict = model.read(list(set(prod_obj._fields)))
print(new_dict)
아바타
취소
베스트 답변

Hi,

You can try like following method.

models_ids = self.env['product.template'].search_read(
[('id', '=', rule.product_id.id)])

Regards

아바타
취소
관련 게시물 답글 화면 활동
3
7월 19
14113
0
3월 21
24
2
7월 19
4331
0
1월 21
3270
1
2월 25
416