Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
10049 Visualizzazioni

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
Abbandona
Autore

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

Risposta migliore

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
Abbandona
Risposta migliore

Hello Michel,

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

Avatar
Abbandona

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;

Post correlati Risposte Visualizzazioni Attività
1
lug 25
463
1
feb 25
1231
0
set 23
2173
2
giu 23
3969
1
ago 22
12726