Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
4978 Zobrazení

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?

Avatar
Zrušit
Autor Nejlepší odpověď

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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
dub 22
3629
1
čvc 21
8522
1
dub 16
10795
1
dub 15
5985
0
bře 23
1802