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

how to write the python search condition parameters?
I tried .....search ['name', 'ilike', 'biblio'] but this creates an error during execution.
Any direction would be greatly appreciated as I am not a developper! :-(


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

the code

Code:

partner_rec = env['res.partner'].search([])

# you can filter the unncessary partners using the condition in search

for partner in partner_rec:

partner.write({'field_name': ''})

คำตอบที่ดีที่สุด

This is an Example:

partner_rec = self.env['res.partner'].search([('name','ilike','biblio')])

Hope it can help you. You can check this documentation to get more explanation: https://www.odoo.com/documentation/12.0/reference/orm.html#common-orm-methods

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

Hello Michel,

You done well but there a syntax issue
search ['name', 'ilike', 'biblio'] this wrong
search([('name', 'ilike', 'biblio')]) this is right

อวตาร
ละทิ้ง

thks Subbarao. I made the correction.

I still have an issue as the server action with this python code does not delete the partner categories as expected;

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 25
449
Search a message แก้ไขแล้ว
1
ก.พ. 25
1228
0
ก.ย. 23
2172
2
มิ.ย. 23
3966
1
ส.ค. 22
12722