예제 #1
0
<?php

include_once 'openerp.class.php';
$rpc = new OpenERP();
$rpc->login("admin", "admin", "registro", "localhost:8069/xmlrpc/");
// SEARCH
$filter = array(array('name', 'ilike', 'andrea'));
$partner_by_name_ids = $rpc->search('res.partner', $filter);
echo 'SEARCH PARTNERS BY NAME IDS:<br />';
print_r($partner_by_name_ids);
$new_filter = array(array('id', '>', 100), array('id', '<', 120));
$partner_by_id_ids = $rpc->search('res.partner', $new_filter);
echo 'SEARCH PARTNERS BY ID IDS:<br />';
print_r($partner_by_id_ids);
// READ
$fields = array('id', 'name', 'ref');
$partners = $rpc->read($partner_by_name_ids, $fields, "res.partner");
echo 'READ PARTNERS:<br />';
foreach ($partners as $p) {
    echo $p['ref'] . ' - ' . $p['name'] . '<br />';
}
// CREATE
$vals = array('name' => new xmlrpcval('John Doe', "string"), 'phone' => new xmlrpcval('000-45679845697', "string"));
$new_partner_id = $rpc->create($vals, "res.partner");
// CALL ON_CHANGHE FUNCTION
// Call the onchange_partner_id function in sale.order for order with id 6 and partner_id 7
$ids = array(6);
$vals = array('part' => array(7, 'int'));
$res = $rpc->call_function('sale.order', 'onchange_partner_id', $ids, $vals);
$res_val = $res->structmem('value');
$user_id = $res_val->structmem('user_id')->scalarval();
예제 #2
0
  <div class="in">
<div class="alert alert-info">
     <center>
     <strong>AVISO:</strong>
     </center>
     <br>
     Estimado usuario le informamos que a partir del 15 de agosto de 2016 la
     oficina del Registro Público de la Propiedad de Dolores Hidalgo, C. I. N.,
     Gto., estará ubicada en Calle Rivera del Rio Norte #55-A, Colonia Centro,
      de dicha ciudad" </div> "</strong></center>
<?php 
$rpc = new OpenERP();
$rpc->login("admin", "admin", "registro8", "localhost:8069/xmlrpc/");
//---------------------------------------------------------------//
$domain = array();
$office_ids = $rpc->search('registros.directorio', $domain);
// READ-----
$fields = array('id', 'responsable_id', 'municipio_id', 'municipio_ids', 'domicilio_id', 'telefono_rp', 'tel_particular', 'correo');
$result = $rpc->read($office_ids, $fields, "registros.directorio");
echo "\n    <div class='table-responsive banner-content'>\n    <table class='table table-striped'>\n    <thead>\n      <tr>\n        <th> REGISTRADOR </th>\n        <th>OFICINA</th>\n        <th>DOMICILIO </th>\n        <th>TEL. REGISTRO PÚBLICO </th>\n        <th>CORREO</th>\n        <th>PARTIDO JUDICIAL</th>\n      </tr>\n    <thead/>\n    <tbody>";
foreach ($result as $p) {
    $responsable = $rpc->read(array($p['responsable_id'][0]), array('name'), "res.users");
    $municipio = $rpc->read(array($p['municipio_id'][0]), array('name'), "municipio");
    $domicilio = $rpc->read(array($p['domicilio_id'][0]), array('name'), "registros.domicilio");
    $pjudicial = $rpc->read($p['municipio_ids'], array('name'), "municipio");
    echo "<tr>";
    echo "<td>" . $responsable[0]['name'] . "</td>";
    echo "<td>" . $municipio[0]['name'] . "</td>";
    echo "<td>" . $domicilio[0]['name'] . "</td>";
    echo "<td>" . $p['telefono_rp'] . "</td>";
    // echo "<td>" . $p['tel_particular'] .  "</td>";
예제 #3
0
<?php

//Conector Odoo-PHP
//---------------------------------------------------------------//
include_once '../openerp.class.php';
$rpc = new OpenERP();
$rpc->login("admin", "admin", "registro", "localhost:8069/xmlrpc/");
//---------------------------------------------------------------//
// SEARCH
$domain = array();
$users_directory = array(array('directorio', 'like', 'res.users'));
$office_ids = $rpc->search('registros.directorio', 'partido.judicial', $domain, $users_directory);
echo 'Resultado del SEARCH:<br />';
print_r($office_ids);
echo "<br/>";
// READ-----
$fields = array('id', 'name', 'municipio_id', 'telefono_rp', 'tel_particular', 'correo');
$result = $rpc->read($office_ids, $fields, "registros.directorio", "partido.judicial");
echo 'Resultado del READ:<br />';
echo "<table> <thead> <tr><th> Nombre </th> <th>municipio_id</th> <th>telefono_rp </th> \n          <th>tel_particular </th> <th>correo </th> </tr><thead/>\n          <tbody>";
foreach ($result as $p) {
    echo "<tr>";
    echo "<td>" . $p['name'] . "</td>" . "<td>" . $p['municipio_id'][0] . "</td>" . "<td>" . $p['telefono_rp'] . "</td>" . "<td>" . $p['tel_particular'] . "</td>" . "<td>" . $p['correo'] . "</td>";
    echo "</tr>";
}
echo "</tbody>, </table>";
$new_filter = array('municipio_id');
$oficina_id = $rpc->search('partido.judicial', $new_filter);
echo 'Busqueda de Oficinas por Nombre:<br />';
print_r($oficina_id);
// READ