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

How it is possible to use .browse method on the model in order to extract data from the database - and in the same time populate data from other table which is in relation with the searched model.

Consider this:
campaign = self.env["test.campaign"].browse(campaignId)

That is going to return the campaign with the proper id which will have (beside others), properties called campaign_templates

campaign.campaing_templates is a list of ids which is pulled from different table (as per definition of the rules in both of the models).

How it is possible to execute .browse method, so campaign.campaign_templates are populated with full objects as well (instead only with ids). Is this possible, or I need to execute second query in order to achieve this? If this is not possible using .browse method, is there any other way to achieve this?

아바타
취소
작성자 베스트 답변

We can close this question. Seems that .browse is already doing that properly. I was missing fields.One2many declaration in one of the models definitions.

아바타
취소
관련 게시물 답글 화면 활동
1
4월 22
3859
1
7월 21
8658
1
4월 16
10980
1
4월 15
6128
0
3월 23
1913