Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3629 Visualizzazioni

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)

Avatar
Abbandona
Risposta migliore

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
Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
giu 19
5738
0
mar 15
4895
1
mar 15
9651
4
gen 17
8248
1
nov 15
6350