تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
9807 أدوات العرض

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;

المنشورات ذات الصلة الردود أدوات العرض النشاط
Search a message تم الحل
1
فبراير 25
752
0
سبتمبر 23
1827
2
يونيو 23
3563
1
أغسطس 22
12208
7
أكتوبر 20
9894