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

in XML RPC you can search for models with arguments like this:

args = [( "name", "=", category_values['name']),]

but what other operator exists beside =, <=, >= ?

in this instance I'm searching for something that acts like MYSQL's LIKE

name LIKE %category_values['name']%

Is this even possible here?

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

Postgres has like and ilike to search with or without case-sensitive application. The other parameters are:

like : [('name', 'like', 'John%')]
ilike : [('name', 'ilike', 'John%')]
= : [('product_id', '=', 122)]
in : [('state', 'in', ('draft', 'done'))]
< : [('price_unit', '<', 14.50)]
<= : >[('price_unit', '<=', 14.50)]
> : [('price_unit', '>', 14.50)]
>= : [('price_unit', '>=', 14.50)]
!= : [('product_id', '!=', 122)]

Also, is interresting to know that OpenERP use Polish Notation to concatenate more search argument. For example if you wanna search a customer with name John you can use:

[('name', 'ilike', 'John%'), ('customer', '=', True)]

Note: the AND operator is implied. If You wanna search a partner called John or Jack you can use this code:

['|', ('name', 'ilike', 'John%'), ('name', 'ilike', 'Jack%')]

where | is the OR operator.

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

Can anyone tell how to write this in php with xmlrpc?

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

Regarding XML-RPC Complete solution is here,

http://goo.gl/rZP1Y6

$data = $rpc->searchread( array(array('email','!=','')), "res.partner"); // CORRECT

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
Search a message Đã xử lý
1
thg 2 25
621
0
thg 9 23
1690
2
thg 6 23
3362
1
thg 8 22
11935
7
thg 10 20
9705