跳至内容
菜单
此问题已终结
3 回复
10054 查看

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;

相关帖文 回复 查看 活动
1
7月 25
466
1
2月 25
1234
0
9月 23
2177
2
6月 23
3976
1
8月 22
12734