Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
18272 Widoki

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


Awatar
Odrzuć
Autor Najlepsza odpowiedź

I have found how to get an ids list.

Just use :

ids.ids

to get :

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

Awatar
Odrzuć
Autor

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

Najlepsza odpowiedź

Hi Pascal,

You can also use like,

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


Regards,

Anil.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
4
wrz 20
41865
New Odoo api Rozwiązane
1
mar 15
3597
1
lut 16
3985
0
paź 22
3222
0
mar 15
5297