Skip to Content
Menu
This question has been flagged
2 Replies
11909 Rodiniai

As per Odoo 10 official documentation, the way to delete data from a model using XMLRPC is:

models.execute_kw(db, uid, password, 'res.partner', 'unlink', [[id]])

If I want to delete all res.partner records, what shall I use as 'id'?

Portretas
Atmesti
Best Answer

Don't use an ID.

models.execute_kw(db, uid, password, 'res.partner', 'unlink', [[]])
Portretas
Atmesti
Autorius

Why [[]] instead of []?

Best Answer
search_ids = models.execute_kw(db, uid, password, 'res.partner', 'search', [])
models.execute_kw(db, uid, password, 'res.partner', 'unlink', search_ids)

Hope this will help you.

Portretas
Atmesti
Autorius

Ray's answer is faster to solve the specific issue, but using a search points how to select a given set of IDs (which might be really useful)

Related Posts Replies Rodiniai Veikla
0
lapkr. 18
2362
2
lapkr. 18
8139
1
rugs. 17
3543
3
rugp. 17
5668
0
geg. 23
2187