Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1847 Lượt xem

Good day,


We make use of the external API and we're struggling to update our code to work between Odoo 15 and Odoo 16.


We're making use of the documentation here.


Here is my code:

https://github.com/bcity-rburger/odoo-playground/blob/main/odoo-16-api-tests.py


So this code works flawlessly in Odoo 15, returning all fields of the record, with their values, however when running the same code against the same db, but upgraded to Odoo 16, we get a traceback error (see pastebin link here) - I also did a similar test with a clean Odoo 16 db, and get the same results.


What are the adjustments needed to return all values of all fields of a specific record in Odoo 16?


Any help would be highly appreciated.


Regards,
Rayno

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

I believe this is a bug in Odoo, for now you can tackle it by specifying the fields(except tax_totals ) you need to read from the model.


fields_to_read = ['name']

sale_order_name = models.execute_kw(db, uid, password, 'sale.order', 'read', [24], {'fields': [fields_to_read]})

Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Hey Niyas,

Thanks for the suggestion and you're right, this does work and returns the value of the fields specified.

I know that by using the get_fields I can get a list of all the fields that are available, but do you know if any way that you can combine the read (or search_read) with get_fields to return all the values in one go?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 25
398
1
thg 8 25
657
2
thg 7 25
3139
3
thg 7 25
795
1
thg 6 25
2310