0

0

I am not even able to authenticate using via ripcord

enter image description here

This is the error I am getting

Is there anyone who can help me to resolve this issue quickly please.

I am using Laravel version 9.46, check using via php artisan -v

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Ripcord\Ripcord;
use DB;

class FetchOdooPHPData extends Command
{
    protected $signature = 'fetch:odoophp-data';
    protected $description = 'Fetch data from Odoo using PHP and update local database';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {

        // Login information
        $url = 'http://urltoodoo::8049';
        $url_auth = $url . '/xmlrpc/2/common';
        $url_exec = $url . '/xmlrpc/2/object';
        $db = 'DBNAME';
        $username = 'username';
        $password = 'APIKEY';
        
        // Login
        $common = Ripcord::client($url_auth);
        $uid = $common->authenticate($db, $username, $password, array());
        print("<p>Your current user id is '${uid}'</p>");
        $models = Ripcord::client($url_exec);
        $models                 // The (Ripcord) client
            ->execute_kw(       // Execute command
            'table.reference',  // Referenced model, e.g. 'res.partner' or 'account.invoice'
            'search',           // Search method of the referenced model
            array()             // Search domain
        );
        $customer_ids = $models->execute_kw(
            $db, // DB name
            $uid, // User id, user login name won't work here
            $password, // User password
            'res.partner', // Model name
            'search', // Function name
            array( // Search domain
                array( // Search domain conditions
                    array('active', '=', true))
                )
        );
        $customers = $models->execute_kw($db, $uid, $password, 'res.partner',
            'read',  // Function name
            array($customer_ids), // An array of record ids
            array('fields'=>array('name')) // Array of wanted fields
        );
        print("<p><strong>Found customers:</strong><br/>");
        foreach ($customers as $customer){
            print("{$customer['name']}<br/>");
        }
        print("</p>");
    }
}
?>

This Ripcord library that i am using is "darkaonline/ripcord": "^0.2.0"

Can anyone help me get authenticate and get the tickets or tasks data from odoo

1

0

Browse other questions tagged or ask your own question.