Odoo Help

0

php xml-rpc: how to search res.partner.category by exact string, not by substring? [Closed]

By
Federico Carrara
on 3/18/14, 11:45 AM 1,658 views

The Question has been closed

by
Ray Carnes
on 03/19/2014 23:47:32

I'm using this code to search the res.partenr.category by category name:

...
        $key = array(
            new xmlrpcval(
                array(
                    new xmlrpcval('name', "string"), // field name
                    new xmlrpcval('=', "string"), // operator
                    new xmlrpcval($tagName, "string")
                ),
                "array"
            ),
                 );
        $msg = new xmlrpcmsg('execute');
        $msg->addParam(new xmlrpcval($this->oe_db, "string"));
        $msg->addParam(new xmlrpcval($this->oe_user_id, "int"));
        $msg->addParam(new xmlrpcval($this->oe_pw, "string"));
        $msg->addParam(new xmlrpcval("res.partner.category", "string"));
        $msg->addParam(new xmlrpcval("search", "string"));
        $msg->addParam(new xmlrpcval($key, "array"));
        $resp = $client->send($msg);
...

this code works fine, but if I search for a string, it returns also categories with a name that "contains" the string: is it possible to search for the EXACT string instead? I've also tried using operator "like" in place of "=", but results are the same: It returns also categories that match a substring.

0
Federico Carrara
On 3/19/14, 2:10 PM

SOLVED. the search actually is an exact text search: but if a category has a parent category, then the visualized name in openerp is the name of parent(s) followed by name of the child category, so this took me on error making me believe that the search was only on a substring of the complete name of the category.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 3/18/14, 11:45 AM
Seen: 1658 times
Last updated: 3/16/15, 8:10 AM