Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
3 Respostas
18263 Visualizações

Hello all,

In the new API, the search() method returns a recordset. For example, this code :

ids = self.search([('default_code', operator, name)])

COuld return something like this :

ids = product.product(1366, 1365, 1325, 1303, 1297, 1296, 1295, 1291)


How could I obtains a list of IDs like this instead????

ids = [1366, 1365, 1325, 1303, 1297, 1296, 1295, 1291]


Thanks


Avatar
Cancelar
Autor Melhor resposta

I have found how to get an ids list.

Just use :

ids.ids

to get :

[1366, 1365, 1325, 1303, 1297, 1296, 1295, 1291]

Avatar
Cancelar
Autor

Probably that products.ids would be a better name for my variable instead of ids.ids...

Melhor resposta

Hi Pascal,

You can also use like,

ids = self.search([('default_code', operator, name)]).ids


Regards,

Anil.

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
4
set. 20
41861
New Odoo api Resolvido
1
mar. 15
3594
1
fev. 16
3982
0
out. 22
3219
0
mar. 15
5297