Пример #1
1
<?php

// https://twitter.com/snippetbucket
include_once 'openerp.class.php';
print "<pre/>\nOpenERP PHP connector : It support version 6 and 7++ <br/>\n Author : Tejas Tank, Tejas.tank.mca@gmail.com\n";
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n";
$rpc = new OpenERP();
$x = $rpc->login("admin", "a", "mobile_client", "http://127.0.0.1:8069/xmlrpc/");
print $x;
#echo $rpc->create( array('name'=>'teja22s', 'code'=> "bakbak"), "res.country");
//echo $rpc->create( array('name'=>'teja22s', 'login'=> "bakbak"), "res.users");
//print_r($rpc->get_fields('sale.order'));
//print_r($rpc->get_default_values('sale.order'));
$data = $rpc->read(array(1, 2), array(), "product.product");
#$data = $rpc->searchread(  array(array('name','=','Service')),  "product.product");  // CORRECT
//$data = $rpc->searchread(  array(array('email','!=','')),  "res.partner");  // CORRECT
##$data = $rpc->read(array(1,2,3,4,5,6,7,8,9), array(), "res.users");
##foreach($data as $p){
##    echo "{$p[name]},{$p[phone]},{$p[email]} {$p[login]} {$p[password]}<br/>";
##}
/////print $partners = $x->unlink(array(19), "res.partner");
Пример #2
0
<div class="container">
  <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>";
 *
 *
 */
/*
https://www.odoo.com/documentation/8.0/api_integration.html#connection
*/
include_once 'openerp.class.php';
$config = (include 'config.php');
$conn = new mysqli($config['dbhost'], $config['dbuser'], $config['dbpassword'], $config['dbname']);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "\nConnected successfully\n\n";
$rpc = new OpenERP();
$x = $rpc->login("admin", "m1e2s3h4-", "meshcom", $config['odoourl'] . "xmlrpc/2/");
sync_user($conn, $rpc);
//sync_operator($conn,$rpc);
create_contract($conn, $rpc);
update_contract($conn, $rpc);
die;
function sync_operator(&$conn, &$rpc)
{
    echo "Sincronizzo operatori \n";
    $operator = (include 'config.operator.php');
    foreach ($operator as $key => $value) {
        $sql = "SELECT * FROM `operator_users` WHERE `operator_id` =" . $key;
        $ids = mysqli_query($conn, $sql) or die("\nError 01: " . mysql_error() . "\n");
        while ($row = mysqli_fetch_object($ids)) {
            if ($row->user_id == "") {
                continue;