Only first record in response
iiram opened this issue · 3 comments
Hello, and thanks for this api!
I'm a beginner with odoo and I probably have something wrong with my approach when I try to get a listing of warehouse locations and their product saldos. The model in question is stock.quant and the problem is that even though the response has the count of records right (in my case 66), details for only the first record is in the response, for all the other details there are just empty rows {}, {},...
I'm testing this with the postman with the url as http://192.168.0.63:8040/api/stock.quant/?session_id=be17cdfa61261f24e7f18e921d8f3c84e0b326d0
and the response payload is
{
"count": 66,
"prev": null,
"current": 1,
"next": null,
"total_pages": 1,
"result": [
{
"__last_update": "2020-06-06-08-05",
"write_date": "2020-06-06-08-05",
"write_uid": 1,
"create_date": "2020-06-06-08-05",
"create_uid": 1,
"display_name": "[FURN_0789] Individual Workplace",
"id": 1,
"currency_id": 1,
"value": 0.0,
"on_hand": false,
"tracking": "none",
"in_date": "2020-06-06-08-06",
"reserved_quantity": 0.0,
"inventory_quantity": 0.0,
"quantity": -16.0,
"owner_id": false,
"package_id": false,
"lot_id": false,
"location_id": 14,
"company_id": 1,
"product_uom_id": 1,
"product_tmpl_id": 22,
"product_id": 30
},
{},
{},
...
What am I doing wrong? Is there a way to somehow get all the records listed with the details.
Many thanks in advance
iiram
Yeah this looks like a bug, for the mean time if you use ?query={field1, field1, ...}
parameter you get all fields included.
Got it, this is the one causing it
odoo-rest-api/controllers/serializers.py
Lines 132 to 137 in 2706c15
reversed
returns a generator which generates items only once, so only the first iteration of the for loop below it has access to the generated items the rest gets empty generator.this Pr is worked.