{"id":13660280,"url":"https://github.com/Edujugon/laradoo","last_synced_at":"2025-04-24T19:30:45.248Z","repository":{"id":40431950,"uuid":"91472391","full_name":"Edujugon/laradoo","owner":"Edujugon","description":"Odoo ERP API for Laravel","archived":false,"fork":false,"pushed_at":"2023-10-31T14:00:59.000Z","size":327,"stargazers_count":159,"open_issues_count":27,"forks_count":99,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-12T10:44:29.505Z","etag":null,"topics":["api","laravel","odoo","odoo-apps"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Edujugon.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-05-16T15:10:37.000Z","updated_at":"2024-08-11T14:37:50.000Z","dependencies_parsed_at":"2024-04-09T18:55:19.468Z","dependency_job_id":"5b930054-3604-446c-863d-7869a8e2e1b8","html_url":"https://github.com/Edujugon/laradoo","commit_stats":{"total_commits":72,"total_committers":7,"mean_commits":"10.285714285714286","dds":0.25,"last_synced_commit":"d91e9fd7f0e948ecd04c64753df505a824e5ec9f"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edujugon%2Flaradoo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edujugon%2Flaradoo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edujugon%2Flaradoo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edujugon%2Flaradoo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Edujugon","download_url":"https://codeload.github.com/Edujugon/laradoo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250693469,"owners_count":21472267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","laravel","odoo","odoo-apps"],"created_at":"2024-08-02T05:01:19.629Z","updated_at":"2025-04-24T19:30:44.961Z","avatar_url":"https://github.com/Edujugon.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Laradoo\n\n\u003cimg src=\"https://raw.githubusercontent.com/Edujugon/laradoo/master/docs/assets/laradoo.png\"\u003e\n\nOdoo ERP API for Laravel. [Odoo website](https://www.odoo.com)\n\n[![Build Status](https://api.travis-ci.org/Edujugon/laradoo.svg)](https://api.travis-ci.org/Edujugon/laradoo)\n[![Total Downloads](https://poser.pugx.org/edujugon/laradoo/downloads)](https://packagist.org/packages/edujugon/laradoo)\n[![Latest Stable Version](https://poser.pugx.org/edujugon/laradoo/v/stable)](https://packagist.org/packages/edujugon/laradoo)\n[![License](https://poser.pugx.org/edujugon/laradoo/license)](https://packagist.org/packages/edujugon/laradoo)\n\n## Compatibility\n\n| Laravel version | PHP version | Package version |\n|---|---|---|\n| ^5.1 | ^5.6 | ^V2.0 |\n| ^5.1 | ^5.5 | ^V1.1 |\n\n## Installation\n\ntype in console:\n\n```shel\ncomposer require edujugon/laradoo\n```\n\nRegister Laradoo service by adding it to the providers array.\n```php\n'providers' =\u003e array(\n        ...\n        Edujugon\\Laradoo\\Providers\\OdooServiceProvider::class\n    )\n```\n\nLet's add the Alias facade, add it to the aliases array.\n```php\n'aliases' =\u003e array(\n        ...\n        'Odoo' =\u003e Edujugon\\Laradoo\\Facades\\Odoo::class,\n    )\n```\n    \nPublish the package's configuration file to the application's own config directory\n\n```php\nphp artisan vendor:publish --provider=\"Edujugon\\Laradoo\\Providers\\OdooServiceProvider\" --tag=\"config\"\n```\n\n### Configuration\n\nAfter publishing the package config file, the base configuration for laradoo package is located in config/laradoo.php\n\n\nAlso, you can dynamically update those values calling the available setter methods:\n\n`host($url)`, `username($username)`, `password($password)`, `db($name)`, `apiSuffix($name)`\n\n\n##  Usage samples\n\nInstance the main Odoo class:\n\n```php\n$odoo = new \\Edujugon\\Laradoo\\Odoo();\n```\nYou can get the Odoo API version just calling the version method:\n\n```php\n$version = $odoo-\u003eversion();\n```\n\u003e This methods doesn't require to be connected/Logged into the ERP.\n\nConnect and log into the ERP:\n\n```php\n$odoo = $odoo-\u003econnect();\n```\n\nAll needed configuration data is taken from `laradoo.php` config file. But you always may pass new values on the fly if required.\n\n```php\n$this-\u003eodoo = $this-\u003eodoo\n            -\u003eusername('my-user-name')\n            -\u003epassword('my-password')\n            -\u003edb('my-db')\n            -\u003ehost('https://my-host.com')\n            -\u003econnect();\n```\n\u003e // Note: `host` should contain 'http://' or 'https://'\n\nAfter login, you can check the user identifier like follows:\n\n```php\n$userId= $this-\u003eodoo-\u003egetUid();\n```\n\nYou always can check the permission on a specific model:\n\n```php\n$can = $odoo-\u003ecan('read', 'res.partner');\n```\n\u003e Permissions which can be checked: 'read','write','create','unlink'\n\nMethod `search provides a collection of ids based on your conditions:\n\n```php\n$ids = $odoo-\u003ewhere('customer', '=', true)\n            -\u003esearch('res.partner');\n```\n\nYou can limit the amount of data using `limit` method and use as many as condition you need:\n\n```php\n$ids = $odoo-\u003ewhere('is_company', true)\n            -\u003ewhere('customer', '=', true)\n            -\u003elimit(3)\n            -\u003esearch('res.partner');\n```\n\nIf need to get a list of models, use the `get` method:\n\n```php\n$models = $odoo-\u003ewhere('customer', true)\n                -\u003elimit(3)\n                -\u003eget('res.partner');\n```\n\nInstead of retrieving all properties of the models, you can reduce it by adding `fields` method before the method `get`\n\n```php\n$models = $odoo-\u003ewhere('customer', true)\n                -\u003elimit(3)\n                -\u003efields('name')\n                -\u003eget('res.partner');\n```\n\nIf not sure about what fields a model has, you can retrieve the model structure data by calling `fieldsOf` method:\n\n```php\n$structure = $odoo-\u003efieldsOf('res.partner');\n```\n\nTill now we have only retrieved data from the ERP but you can also Create and Delete records.\n\nIn order to create a new record just call `create` method as follows:\n\n```php\n$id = $odoo-\u003ecreate('res.partner',['name' =\u003e 'Jonh Odoo']);\n```\n\u003e The method returns the id of the new record.\n\nFor Deleting records we have the `delete` method:\n\n```php\n$result = $odoo-\u003ewhere('name', 'Jonh Odoo')\n            -\u003edelete('res.partner');\n```\n\u003e Notice that before calling `delete` method you have to use `where`.\n\nYou can also remove records by ids like follows:\n\n```php\n$result = $odoo-\u003edeleteById('res.partner',$ids);\n```\n\nUpdate any record of your ERP:\n\n```php\n$updated = $odoo-\u003ewhere('name', 'John Odoo')\n            -\u003eupdate('res.partner',['name' =\u003e 'John Odoo Odoo','email' =\u003e 'Johndoe@odoo.com']);\n```\n\nNotice that all `delete` and `update` methods always returns `true` except if there was an error.\n\n`call` method is also available for those who want to set a custom API call:\n\n```php\n$odoo-\u003ecall('res.partner', 'search',[\n        [\n            ['is_company', '=', true],\n            ['customer', '=', true]\n        ]\n    ],[\n        'offset'=\u003e1,\n        'limit'=\u003e5\n    ]);\n```\n\n##  [Full API list](https://edujugon.github.io/laradoo/build/master/Edujugon/Laradoo/Odoo.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEdujugon%2Flaradoo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEdujugon%2Flaradoo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEdujugon%2Flaradoo/lists"}