PHPackages                             sefirosweb/laravel-odoo-connector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. sefirosweb/laravel-odoo-connector

ActiveLibrary[Database &amp; ORM](/categories/database)

sefirosweb/laravel-odoo-connector
=================================

Driver to connect Odoo using ORM of laravel

v1.3.3(7mo ago)3340↓31.3%2MITPHP

Since Aug 17Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/sefirosweb/laravel-odoo-connector)[ Packagist](https://packagist.org/packages/sefirosweb/laravel-odoo-connector)[ RSS](/packages/sefirosweb-laravel-odoo-connector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (35)Used By (0)

laravel-odoo-connector
======================

[](#laravel-odoo-connector)

Driver to connect Odoo using ORM of laravel, it is based in JSON RPC.

[Odoo Web Services Documentation JSON RPC](https://www.odoo.com/documentation/master/developer/howtos/web_services.html).

Why use laravel-odoo-connector instead a postgresql connection?
---------------------------------------------------------------

[](#why-use-laravel-odoo-connector-instead-a-postgresql-connection)

It seems that it is easier to connect directly to the postgres database instead of using laravel-odoo-connector (based on json-rpc)

The advantage is that when you execute actions like "modify" or "create" objects, odoo has triggers that fire automated actions,

If you execute this in a raw postgress statement these events / actions will not be executed, so it is important to follow the odoo workflow, and odoo provides us with json-rpc to be able to perform these actions,

For example you could have a trigger in odoo that sends the invoice to the client when it is created,

Also laravel-odoo-connector provides the ability to execute model "actions",

For example once the SaleOrder is created it can be confirmed

```
$sale_order = SaleOrder::find(1);
$sale_order->action('action_confirm');
```

It triggers the button "confirm" in the [odoo model](https://github.com/odoo/odoo/blob/a80f9a4be4c4da8980067d1ba9beca53b431f83b/addons/sale/models/sale_order.py#L918)

Installation - Composer
-----------------------

[](#installation---composer)

You can install the package via composer:

```
composer require sefirosweb/laravel-odoo-connector

```

Add in database.php the configuration for odoo
----------------------------------------------

[](#add-in-databasephp-the-configuration-for-odoo)

```
// database.php
    'connections' => [
        // ...

        'odoo' => [
            'driver' => 'odoo',
            'host' => env('ODOO_HOST', 'https://your-odoo-host.com'),
            'database' => env('ODOO_DB', 'db_name'),
            'username' => env('ODOO_USERNAME', 'user'),
            'password' => env('ODOO_PASSWORD', 'api_key'),
            'defaultOptions' => [
                'timeout' => 20,
                'context' => [
                    'lang' => 'es_ES'
                ],
            ],
        ],

    ],
```

Usage
-----

[](#usage)

Import the models of odoo in your controller

```
use Sefirosweb\LaravelOdooConnector\Http\Models\ProductProduct;

class YourController extends Controller
{
    public function index()
    {
        $products = ProductProduct::where('name', 'like', '%product%')->with('mrp_bom')->get();
        return view('products.index', compact('products'));
    }
}
```

You can use all methods of Eloquent ORM, like `find`, `where`, `whereHas`, `with`, `create`, `update`, `delete`, etc.

```
$product = ProductProduct::find(1);
$product->name = 'New name';
$product->save();

$product = ProductProduct::create([
    'name' => 'Product 1',
    'description' => 'Description of product 1',
    'list_price' => 100,
    // ...
]);
```

Customize your models
---------------------

[](#customize-your-models)

A lot of times you need to modify the models or create new ones, publish the config file and extends the models and,

```
class YourCustomProductProduct extends Sefirosweb\LaravelOdooConnector\Http\Models\ProductProduct
{
    protected $table = 'product.product';

    public function your_custom_belongs(): BelongTo
    {
        return $this->belongsTo(YourCustomModel::class, 'your_field_id');
    }
}
```

### Publish config, to make override of Odoo Models

[](#publish-config-to-make-override-of-odoo-models)

```
php artisan vendor:publish --provider="Sefirosweb\LaravelOdooConnector\LaravelOdooConnectorServiceProvider"  --tag=config --force
```

With that you can add more relations or edit them, configure your own models, in the file `config/laravel-odoo-connector.php`

```
return [
    'ProductProduct' => App\Http\Models\YourCustomProductProduct::class,
    'ProductTemplate' => Sefirosweb\LaravelOdooConnector\Http\Models\ProductTemplate::class,
    'ResLang' => Sefirosweb\LaravelOdooConnector\Http\Models\ResLang::class,
    ///...
];
```

### SoftDelete

[](#softdelete)

If you need to use soft delete "active" import the trait Sefirosweb\\LaravelOdooConnector\\Http\\Traits\\SoftDeleteOdoo

```
use Sefirosweb\LaravelOdooConnector\Http\Traits\SoftDeleteOdoo;

class ProductProduct extends OdooModel
{
    use SoftDeleteOdoo;
    // ...
}
```

Multiple Odoo Connections
-------------------------

[](#multiple-odoo-connections)

Add in database.php the configuration for odoo, only add connection in the model

```
use Sefirosweb\LaravelOdooConnector\Http\Models\OdooModel;

class YourMainOdooModel extends OdooModel
{
    protected $connection = 'other_odoo_connection';

    public function getConnection()
    {
        return app('db')->connection('other_odoo_connection');
    }
}
```

Custom get all records
----------------------

[](#custom-get-all-records)

If you need to get all records, you can use the method `get_all` in the model, this is execute in chunks of 500 records to avoid odoo timeout, is same has `all` method of Eloquent ORM

```
$products = ProductProduct::get_all('id', 'name', 100);
```

Model Actions
-------------

[](#model-actions)

You can execute actions of the model, for example, confirm a sale order

```
$sale_order = SaleOrder::find(1);
$sale_order->action('action_confirm');
```

For custom actions you can provide more data;

```
$args = [['id' => 1]];
SaleOrder::model_action('action_custom', $args);
```

TODOS
-----

[](#todos)

- Add the rest of models of Odoo (pos, pos\_line...)
- Add tests

Tests:
------

[](#tests)

```
php artisan test packages/laravel-odoo-connector/tests/Feature/RandomTests.php
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance62

Regular maintenance activity

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~12 days

Total

34

Last Release

239d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e00c36bae7e59a7375c9bc0e0280ef4004afa4ca968ea6cd62f7d880df2dbd66?d=identicon)[sefirosweb](/maintainers/sefirosweb)

---

Top Contributors

[![sefirosweb](https://avatars.githubusercontent.com/u/20754836?v=4)](https://github.com/sefirosweb "sefirosweb (49 commits)")[![MElkmeshi](https://avatars.githubusercontent.com/u/95718825?v=4)](https://github.com/MElkmeshi "MElkmeshi (3 commits)")

### Embed Badge

![Health badge](/badges/sefirosweb-laravel-odoo-connector/health.svg)

```
[![Health](https://phpackages.com/badges/sefirosweb-laravel-odoo-connector/health.svg)](https://phpackages.com/packages/sefirosweb-laravel-odoo-connector)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
