Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
10016 Zobrazení

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

Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

Hello Michel,

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

Avatar
Zrušit

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 Odpovědi Zobrazení Aktivita
1
čvc 25
424
1
úno 25
1218
0
zář 23
2160
2
čvn 23
3938
1
srp 22
12714