Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
3 Antworten
9812 Ansichten

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

Beste Antwort

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
Verwerfen
Beste Antwort

Hello Michel,

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

Avatar
Verwerfen

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;

Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Feb. 25
762
0
Sept. 23
1854
2
Juni 23
3584
1
Aug. 22
12234
7
Okt. 20
9909