This question has been flagged
2 Replies
7038 Views

Hi,

I'm working on an PHP API to connect to Odoo from our external business intranet, developed in Codeigniter PHP.

I can authenticate correctly but when trying to execute a search I get the following error:

AssertionError: Domains to normalize must have a 'domain' form: a list or tuple of domain components

This is the PHP Code used for the request.

$this->xmlrpc->server($this->url.$this->ep_object);

$this->xmlrpc->method('execute_kw'); $request = array(
   array($this->db, 'string'),
array($this->user_id , 'int'),
array($this->password, 'string'),
array('res.partner', 'string'),
array('search', 'string'),
array(
array(
array(
array('is_company', '=', true),
array('customer', '=', true)
)
)
, 'struct')
);
$this->xmlrpc->request($request);
if ( ! $this->xmlrpc->send_request()) {
echo $this->xmlrpc->display_error();
}
else
{                
$val = $this->xmlrpc->display_response(); 
    var_dump($val);
}

As you can see I'm just trying to replicate the API Docs code using the XMLRPC library from CodeIgniter, but the problem is in the last parameter on the request. I don't know what else I could try. Tried already an empty array and so on, with no success.

Avatar
Discard
Best Answer

Try to change 'struct' parameter to 'array'. It worked for me.

I.e.

           array('search', 'string'),

array(
array(
array(
array('is_company', '=', true),
array('customer', '=', true)
)
)
, 'array')
);


Avatar
Discard
Best Answer

Hi Daniel:

You may want to go through the excellent API documentation with code samples provided by Odoo at the following link:

External API

Avatar
Discard