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

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'?

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

Don't use an ID.

models.execute_kw(db, uid, password, 'res.partner', 'unlink', [[]])
อวตาร
ละทิ้ง
ผู้เขียน

Why [[]] instead of []?

คำตอบที่ดีที่สุด
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.

อวตาร
ละทิ้ง
ผู้เขียน

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 ตอบกลับ มุมมอง กิจกรรม
0
พ.ย. 18
2368
2
พ.ย. 18
8140
1
ก.ย. 17
3547
XMLRPC create picklist in odoo 10 API แก้ไขแล้ว
3
ส.ค. 17
5681
0
พ.ค. 23
2198