Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
10052 Lượt xem

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


Ảnh đại diện
Huỷ bỏ
Tác giả

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

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Michel,

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

Ảnh đại diện
Huỷ bỏ

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;

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 25
464
Search a message Đã xử lý
1
thg 2 25
1232
0
thg 9 23
2176
2
thg 6 23
3976
1
thg 8 22
12732