2017 © Pedro Peláez
 

library laradoo

Odoo ERP API for Laravel

image

edujugon/laradoo

Odoo ERP API for Laravel

  • Sunday, June 4, 2017
  • by edujugon
  • Repository
  • 9 Watchers
  • 36 Stars
  • 995 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 13 Forks
  • 0 Open issues
  • 14 Versions
  • 11 % Grown

The README.md

Laradoo

, (*1)

Odoo ERP API for Laravel. Odoo website, (*2)

Build Status Total Downloads Latest Stable Version License, (*3)

Compatibility

Laravel version PHP version Package version
^5.1 ^5.6 ^V2.0
^5.1 ^5.5 ^V1.1

Installation

type in console:, (*4)

composer require edujugon/laradoo

Register Laradoo service by adding it to the providers array., (*5)

'providers' => array(
        ...
        Edujugon\Laradoo\Providers\OdooServiceProvider::class
    )

Let's add the Alias facade, add it to the aliases array., (*6)

'aliases' => array(
        ...
        'Odoo' => Edujugon\Laradoo\Facades\Odoo::class,
    )

Publish the package's configuration file to the application's own config directory, (*7)

php artisan vendor:publish --provider="Edujugon\Laradoo\Providers\OdooServiceProvider" --tag="config"

Configuration

After publishing the package config file, the base configuration for laradoo package is located in config/laradoo.php, (*8)

Also, you can dynamically update those values calling the available setter methods:, (*9)

host($url), username($username), password($password), db($name), apiSuffix($name), (*10)

Usage samples

Instance the main Odoo class:, (*11)

$odoo = new \Edujugon\Laradoo\Odoo();

You can get the Odoo API version just calling the version method:, (*12)

$version = $odoo->version();

This methods doesn't require to be connected/Logged into the ERP., (*13)

Connect and log into the ERP:, (*14)

$odoo = $odoo->connect();

All needed configuration data is taken from laradoo.php config file. But you always may pass new values on the fly if required., (*15)

$this->odoo = $this->odoo
            ->username('my-user-name')
            ->password('my-password')
            ->db('my-db')
            ->host('https://my-host.com')
            ->connect();

// Note: host should contain 'http://' or 'https://', (*16)

After login, you can check the user identifier like follows:, (*17)

$userId= $this->odoo->getUid();

You always can check the permission on a specific model:, (*18)

$can = $odoo->can('read', 'res.partner');

Permissions which can be checked: 'read','write','create','unlink', (*19)

Method `search provides a collection of ids based on your conditions:, (*20)

$ids = $odoo->where('customer', '=', true)
            ->search('res.partner');

You can limit the amount of data using limit method and use as many as condition you need:, (*21)

$ids = $odoo->where('is_company', true)
            ->where('customer', '=', true)
            ->limit(3)
            ->search('res.partner');

If need to get a list of models, use the get method:, (*22)

$models = $odoo->where('customer', true)
                ->limit(3)
                ->get('res.partner');

Instead of retrieving all properties of the models, you can reduce it by adding fields method before the method get, (*23)

$models = $odoo->where('customer', true)
                ->limit(3)
                ->fields('name')
                ->get('res.partner');

If not sure about what fields a model has, you can retrieve the model structure data by calling fieldsOf method:, (*24)

$structure = $odoo->fieldsOf('res.partner');

Till now we have only retrieved data from the ERP but you can also Create and Delete records., (*25)

In order to create a new record just call create method as follows:, (*26)

$id = $odoo->create('res.partner',['name' => 'Jonh Odoo']);

The method returns the id of the new record., (*27)

For Deleting records we have the delete method:, (*28)

$result = $odoo->where('name', 'Jonh Odoo')
            ->delete('res.partner');

Notice that before calling delete method you have to use where., (*29)

You can also remove records by ids like follows:, (*30)

$result = $odoo->deleteById('res.partner',$ids);

Update any record of your ERP:, (*31)

$updated = $odoo->where('name', 'John Odoo')
            ->update('res.partner',['name' => 'John Odoo Odoo','email' => 'Johndoe@odoo.com']);

Notice that all delete and update methods always returns true except if there was an error., (*32)

call method is also available for those who want to set a custom API call:, (*33)

$odoo->call('res.partner', 'search',[
        [
            ['is_company', '=', true],
            ['customer', '=', true]
        ]
    ],[
        'offset'=>1,
        'limit'=>5
    ]);

Full API list

The Versions

04/06 2017

dev-master

9999999-dev

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

04/06 2017

dev-dev

dev-dev

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

04/06 2017

1.1.1

1.1.1.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

28/05 2017

1.1.0

1.1.0.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

25/05 2017

1.0.9

1.0.9.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

22/05 2017

1.0.8

1.0.8.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

19/05 2017

1.0.7

1.0.7.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

18/05 2017

1.0.6

1.0.6.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

18/05 2017

1.0.5

1.0.5.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

18/05 2017

1.0.4

1.0.4.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

18/05 2017

1.0.3

1.0.3.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

17/05 2017

1.0.2

1.0.2.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

17/05 2017

1.0.1

1.0.1.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo

17/05 2017

1.0.0

1.0.0.0

Odoo ERP API for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Marcos

laravel package erp odoo