xml rpc — php xmlrpc ошибка поиска odoo 10

У меня есть эта ошибка, когда я хочу провести исследование внутри Odoo 10 принять значение. На Odoo 8У меня нет проблем.

Неустранимая ошибка: необработанная ошибка: вызов функции-члена scalarval () включен
целое число

проблема исходит из этой строки: $ids = $val->scalarval();

Если я сделаю это раньше scalarval()

 $val = $response->value();

ответ

 var_dump($val);
int(0)

идея решить этот элемент?

функция

Public function odooSearch($attribute, $operator, $keys, $relation, $string = 'string', $offset = 0, $limit = 1 ) {

$client = new \xmlrpc_client($this->server_url . "/xmlrpc/object");
$client->setSSLVerifyPeer(0);

$domain_filter = array(new \xmlrpcval(
array(new \xmlrpcval($attribute , "string"),
new \xmlrpcval($operator,"string"),
new \xmlrpcval($keys, $string),),"array"),);

$msg = new \xmlrpcmsg('execute');
$msg->addParam(new \xmlrpcval($this->database, "string"));
$msg->addParam(new \xmlrpcval($this->id, "int"));
$msg->addParam(new \xmlrpcval($this->password, "string"));
$msg->addParam(new \xmlrpcval($relation, "string"));
$msg->addParam(new \xmlrpcval("search", "string"));
$msg->addParam(new \xmlrpcval($domain_filter, "array"));
$msg->addParam(new \xmlrpcval($offset, "int")); // OFFSET, START FROM
$msg->addParam(new \xmlrpcval($limit, "int")); // MAX RECORD LIMITS

$response = $client->send($msg);

$val = $response->value();
$ids = $val->scalarval();

return $this->traverse_structure($ids);
}

Я называю функцию этой функцией, например

  function osc_cfg_use_function_config_create_wharehouse() {

$OSCOM_ODOO = Registry::get('Odoo');
$OSCOM_Db = Registry::get('Db');

if (ODOO_WHAREHOUSE_CONFIG == 'configure' && ODOO_ACTIVATE_WEB_SERVICE == 'true') {

$company_id = $OSCOM_ODOO->getSearchCompanyIdOdoo();
$date = date("Y-m-d H:i:s");

// Stock Management
$ids = $OSCOM_ODOO->odooSearchByTwoCriteria('company_id', '=', $company_id, 'stock.warehouse', 'int',
'name', '=',  'ClicShopping', 'string');
// read id company odoo
$field_list = array('id');

$company_id_wharehouse = $OSCOM_ODOO->readOdoo($ids, $field_list, 'stock.warehouse');
$company_id_wharehouse = $company_id_wharehouse[0][id];

if (empty($company_id_wharehouse)) {

$values = array("name" => new xmlrpcval('ClicShopping', "string"),
"code" => new xmlrpcval('CL', "string"),
"partner_id" => new xmlrpcval($company_id, "int"),
);

$OSCOM_ODOO->createOdoo($values, "stock.warehouse");

} else {

$values = array("name" => new xmlrpcval('ClicShopping', "string"),
"code" => new xmlrpcval('CL', "string"),
"partner_id" => new xmlrpcval($company_id, "int"),
);

$OSCOM_ODOO->updateOdoo($company_id_wharehouse, $values, "stock.warehouse");

}

// Inventory creation
// search location name and id in stock location
$ids = $OSCOM_ODOO->odooSearch('name', '=', "CL", 'stock.location');

$field_list = array('id',
'location_id',
'name',
);

$Qstock_location = $OSCOM_ODOO->readOdoo($ids, $field_list, 'stock.location');
$stock_location_id = $Qstock_location[0][id];
$stock_location_name = $Qstock_location[0][name];

$stock_location_id = $stock_location_id + 1;

$values = array("name" => new xmlrpcval("ClicShopping", "string"),
"date" => new xmlrpcval($date, "string"),
"company_id" => new xmlrpcval($company_id, "int"),
"location_id" => new xmlrpcval($stock_location_id, "int"),
"filter" => new xmlrpcval('none', "string"),
);

$OSCOM_ODOO->createOdoo($values, "stock.inventory");$Qupdate = $OSCOM_Db->prepare('update :table_configuration
set configuration_value = :configuration_value
where configuration_key = :configuration_key
');
$Qupdate->bindValue(':configuration_value', 'false');
$Qupdate->bindValue(':configuration_key', 'ODOO_WHAREHOUSE_CONFIG');
$Qupdate->execute();
}
}

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]