Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3650 มุมมอง

Hello

We have a job which aims at creating many ( > 500) object from a wizard. Those objects are from a custom model.
Creating each object and writing it to database is very slow; is it possible to prepare a dict of values et ask Odoo ORM to create every objects with only one DB call ?

Any help will be useful, thank you, community, by advance

Lionel (e-COSI)

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can replace ORM functions search(), search_read() with PSQL select query. You can also use insert into the query to create records but it is not promoted.

eg:


query = "...."
cr.execute(query, params
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
ORM: Create a record with a psecific id แก้ไขแล้ว
1
มิ.ย. 19
5746
0
มี.ค. 15
4914
1
มี.ค. 15
9678
4
ม.ค. 17
8279
1
พ.ย. 15
6378