Skip to Content
Menú
This question has been flagged
3 Respostes
9792 Vistes

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! :-(


Avatar
Descartar
Autor

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': ''})

Best Answer

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

Avatar
Descartar
Best Answer

Hello Michel,

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

Avatar
Descartar

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 Respostes Vistes Activitat
1
de febr. 25
714
0
de set. 23
1799
2
de juny 23
3532
1
d’ag. 22
12151
7
d’oct. 20
9866