Download the PHP package sefirosweb/laravel-odoo-connector without Composer
On this page you can find all versions of the php package sefirosweb/laravel-odoo-connector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sefirosweb/laravel-odoo-connector
More information about sefirosweb/laravel-odoo-connector
Files in sefirosweb/laravel-odoo-connector
Package laravel-odoo-connector
Short Description Driver to connect Odoo using ORM of laravel
License MIT
Informations about the package 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.
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
It triggers the button "confirm" in the odoo model
Installation - Composer
You can install the package via composer:
Add in database.php the configuration for odoo
Usage
Import the models of odoo in your controller
You can use all methods of Eloquent ORM, like find
, where
, whereHas
, with
, create
, update
, delete
, etc.
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,
Publish config, to make override of Odoo Models
With that you can add more relations or edit them, configure your own models, in the file config/laravel-odoo-connector.php
SoftDelete
If you need to use soft delete "active" import the trait Sefirosweb\LaravelOdooConnector\Http\Traits\SoftDeleteOdoo
Multiple Odoo Connections
Add in database.php the configuration for odoo, only add connection in the model
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
Model Actions
You can execute actions of the model, for example, confirm a sale order
For custom actions you can provide more data;
TODOS
- Add the rest of models of Odoo (pos, pos_line...)
- Add tests