PHPackages                             winternet-studio/odoo-jsonrpc-client - 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. [API Development](/categories/api)
4. /
5. winternet-studio/odoo-jsonrpc-client

ActiveLibrary[API Development](/categories/api)

winternet-studio/odoo-jsonrpc-client
====================================

A simple Odoo JSON-RPC client you can understand

v1.3.1(6mo ago)71.8k↓53.9%MITPHP

Since Nov 3Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/winternet-studio/php-odoo-jsonrpc-client)[ Packagist](https://packagist.org/packages/winternet-studio/odoo-jsonrpc-client)[ RSS](/packages/winternet-studio-odoo-jsonrpc-client/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

php-odoo-jsonrpc-client
=======================

[](#php-odoo-jsonrpc-client)

A simple Odoo JSON-RPC client you can understand - and with examples. Written in PHP.

Let's just put the truth out there - Odoo's API documentation is terrible... if you can even find any! But with this library I'll try to make it a little less terrible to work with its API.

It's currently a work in progress. Feel free to help by doing pull requests.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

```
composer require winternet-studio/odoo-jsonrpc-client

```

Usage
-----

[](#usage)

Connecting to Odoo:

```
$baseUri = 'https://yourodooserver.com';
$database = 'databaseName';
$username = 'johndoe@sample.com';
$password = 'mypassword';
$odoo = new \winternet\odoo\JsonRpcClient($baseUri, $database, $username, $password);

echo $odoo->version('major');

$userID = $odoo->authenticate();
```

Or to use the higher level helper classes:

```
$companyID = 5;
$odoo = new \winternet\odoo\helpers\Core($baseUri, $database, $username, $password, $companyID);
$account = $odoo->accounting->getAccount($accountID);

$filters = [];
$filters[] = ['company_id', '=', $companyID];
$filters[] = ['account_id', '=', 45805];
$filters[] = ['date', '>=', '2025-01-01'];
$filters[] = ['date', 'read('account.move', $recordID, [], ['single' => 'require']);  // return a single record or throw exception if it isn't found
```

### Update a record

[](#update-a-record)

```
$odoo->update('res.partner', 3, ['name' => 'The New Name']);
```

### Post a record that is currently a draft

[](#post-a-record-that-is-currently-a-draft)

Eg. post a payment (`account.payment`) or invoice (`account.move`).

```
$recordIDs = [17113];
$odoo->actionPost('account.payment', $recordIDs);
```

### Get invoices

[](#get-invoices)

```
$invoices = $odoo->searchRead('account.move', [
	'where' => [
		[
			'move_type',
			'=',
			'out_invoice',
		],
		[
			'partner_id',
			'=',
			(int) $partner_id,  // IMPORTANT: IDs must be an integer!!
		],
	],
	'limit' => 3,
	'fields' => ['name', 'create_date', 'amount_total_signed'],
], [
	// 'expandFields' => ['invoice_line_ids' => ['model' => 'account.move.line']],  //enable this line to include invoice lines - see expandFields in execute() method in JsonRpcClient class file
]);
```

### Create invoice

[](#create-invoice)

This invoice example is originally a copy from the network request in the browser.

It is created as a draft and must be posted using the `actionPost()` method as in the example above. Seems not possible to post it at the same time as creating it.

```
$createdInvoice = $odoo->create('account.move', [
	'move_type' => 'out_invoice',
	'date' => '2023-10-31',
	// 'show_name_warning' => false,
	// 'posted_before' => false,
	// 'payment_state' => 'not_paid',
	// 'name' => false,
	'partner_id' => 6060,
	'partner_shipping_id' => 6060,  //to set shipping address (in UI they default it to same as customer)
	'ref' => '',
	'payment_reference' => '',
	// 'partner_bank_id' => 55,
	// 'invoice_vendor_bill_id' => false,
	'invoice_date' => '2023-10-31',
	'invoice_date_due' => '2023-11-07',
	'invoice_payment_term_id' => 26,  //ADJUST TO YOUR INSTANCE. Set to false for no payment term, eg. if setting a date instead.
	'journal_id' => 136,  //ADJUST TO YOUR INSTANCE
	'currency_id' => 3,  //ADJUST TO YOUR INSTANCE
	'invoice_line_ids' => [
		[
			0,
			'virtual_848',  // what is this?
			[
				// 'sequence' => 10,
				// 'product_id' => false,
				'name' => 'Line 1',  //invoice line description
				'account_id' => 5262,    //ADJUST TO YOUR INSTANCE
				// 'analytic_account_id' => false,
				// 'analytic_tag_ids' => [
				//     [
				//         6,
				//         false,
				//         [],
				//     ],
				// ],
				// 'asset_profile_id' => false,
				// 'asset_id' => false,
				'quantity' => 1,
				// 'product_uom_id' => false,
				'price_unit' => 55.00,
				// 'discount' => 0,
				'tax_ids' => [
					[
						6,
						false,
						[366],  //ADJUST TO YOUR INSTANCE. Empty array for no tax. Add entry with integer of tax_id to apply tax.
					],
				],
				// 'partner_id' => 6060,
				// 'amount_currency' => -55,
				// 'currency_id' => 3,
				// 'debit' => 0,  /// isn't this always automatically determined?
				// 'credit' => 614.98,  /// isn't this always automatically determined?
				// 'date_maturity' => false,
				// 'tax_tag_ids' => [
				//     [
				//         6,
				//         false,
				//         [],
				//     ],
				// ],
				// 'recompute_tax_line' => false,
				// 'display_type' => false,
				// 'is_rounding_line' => false,
				// 'exclude_from_invoice_tab' => false,
			],
		],
	],
	'narration' => 'This is the comments field',
	// // Journal Elements which are automatically created:
	// 'line_ids' => [
	//     [
	//         0,
	//         'virtual_945',
	//         [
	//             'analytic_tag_ids' => [
	//                 [
	//                     6,
	//                     false,
	//                     [],
	//                 ],
	//             ],
	//             'tax_ids' => [
	//                 [
	//                     6,
	//                     false,
	//                     [],
	//                 ],
	//             ],
	//             'tax_tag_ids' => [
	//                 [
	//                     6,
	//                     false,
	//                     [],
	//                 ],
	//             ],
	//             'account_id' => 5242,
	//             'sequence' => 10,
	//             'name' => '',
	//             'quantity' => 1,
	//             'price_unit' => -11255,
	//             'discount' => 0,
	//             'debit' => 125846.36,
	//             'credit' => 0,
	//             'amount_currency' => 11255,
	//             'date_maturity' => '2023-11-07',
	//             'currency_id' => 3,
	//             'partner_id' => 6060,
	//             'product_uom_id' => false,
	//             'product_id' => false,
	//             'tax_base_amount' => 0,
	//             'tax_exigible' => true,
	//             'tax_repartition_line_id' => false,
	//             'recompute_tax_line' => false,
	//             'display_type' => false,
	//             'is_rounding_line' => false,
	//             'exclude_from_invoice_tab' => true,
	//             'asset_profile_id' => false,
	//             'asset_id' => false,
	//             'analytic_account_id' => false,
	//         ],
	//     ],
	//     [
	//         0,
	//         '',
	//         [
	//             'analytic_tag_ids' => [
	//                 [
	//                     6,
	//                     false,
	//                     [],
	//                 ],
	//             ],
	//             'tax_ids' => [
	//                 [
	//                     6,
	//                     false,
	//                     [],
	//                 ],
	//             ],
	//             'tax_tag_ids' => [
	//                 [
	//                     6,
	//                     false,
	//                     [],
	//                 ],
	//             ],
	//             'account_id' => 5262,
	//             'sequence' => 10,
	//             'name' => 'Line 1',
	//             'quantity' => 1,
	//             'price_unit' => 55,
	//             'discount' => 0,
	//             'debit' => 0,
	//             'credit' => 614.98,
	//             'amount_currency' => -55,
	//             'date_maturity' => false,
	//             'currency_id' => 3,
	//             'partner_id' => 6060,
	//             'product_uom_id' => false,
	//             'product_id' => false,
	//             'tax_base_amount' => 0,
	//             'tax_exigible' => true,
	//             'tax_repartition_line_id' => false,
	//             'recompute_tax_line' => false,
	//             'display_type' => false,
	//             'is_rounding_line' => false,
	//             'exclude_from_invoice_tab' => false,
	//             'asset_profile_id' => false,
	//             'asset_id' => false,
	//             'analytic_account_id' => false,
	//         ],
	//     ],
	//     [
	//         0,
	//         'virtual_922',
	//         [
	//             'analytic_tag_ids' => [
	//                 [
	//                     6,
	//                     false,
	//                     [],
	//                 ],
	//             ],
	//             'tax_ids' => [
	//                 [
	//                     6,
	//                     false,
	//                     [],
	//                 ],
	//             ],
	//             'tax_tag_ids' => [
	//                 [
	//                     6,
	//                     false,
	//                     [],
	//                 ],
	//             ],
	//             'account_id' => 5255,
	//             'sequence' => 10,
	//             'name' => 'Line 2',
	//             'quantity' => 70,
	//             'price_unit' => 160,
	//             'discount' => 0,
	//             'debit' => 0,
	//             'credit' => 125231.38,
	//             'amount_currency' => -11200,
	//             'date_maturity' => '2023-11-07',
	//             'currency_id' => 3,
	//             'partner_id' => 6060,
	//             'product_uom_id' => false,
	//             'product_id' => false,
	//             'tax_base_amount' => 0,
	//             'tax_exigible' => true,
	//             'tax_repartition_line_id' => false,
	//             'recompute_tax_line' => false,
	//             'display_type' => false,
	//             'is_rounding_line' => false,
	//             'exclude_from_invoice_tab' => false,
	//             'asset_profile_id' => false,
	//             'asset_id' => false,
	//             'analytic_account_id' => false
	//         ],
	//     ],
	// ],
	// 'user_id' => 42,
	// 'invoice_user_id' => 42,
	// 'team_id' => 11,
	// 'invoice_origin' => false,
	// 'qr_code_method' => false,
	// 'invoice_incoterm_id' => false,
	// 'fiscal_position_id' => false,
	// 'invoice_cash_rounding_id' => false,
	// 'invoice_source_email' => false,
	// 'auto_post' => false,  //schedule the record to be automatically posted on the invoice date? Defaults to false
	// 'to_check' => false,
	// 'campaign_id' => false,
	// 'medium_id' => false,
	// 'source_id' => false,
	// 'message_follower_ids' => [],
	// 'activity_ids' => [],
	// 'message_ids' => [],
]);
```

### Create payment

[](#create-payment)

```
$paymentID = $odoo->create('account.payment', [
	// 'name' => false,
	'payment_type' => 'inbound',
	'partner_type' => 'customer',
	'partner_id' => 6197,
	// 'destination_account_id' => 560,
	// 'is_internal_transfer' => false,
	'company_id' => 4,
	'journal_id' => 22,
	'payment_method_id' => 3,
	// 'payment_token_id' => false,
	// 'partner_bank_id' => false,
	'amount' => 100,
	'currency_id' => 15,
	'date' => '2023-11-05',
	// 'ref' => false,
	// 'message_follower_ids' => [],
	// 'activity_ids' => [],
	// 'message_ids' => [],
]);
```

### Get currencies

[](#get-currencies)

Get currencies, with array index values being the currency code.

```
$currencies = $odoo->searchRead('res.currency', [], ['indexBy' => 'name']);
```

### Update currencies with today's rates

[](#update-currencies-with-todays-rates)

Update rates with data from European Central Bank.

```
$odoo->updateExchangeRates();
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance66

Regular maintenance activity

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~191 days

Total

5

Last Release

208d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3822682?v=4)[winternet](/maintainers/winternet)[@winternet](https://github.com/winternet)

---

Top Contributors

[![winternet-studio](https://avatars.githubusercontent.com/u/5200270?v=4)](https://github.com/winternet-studio "winternet-studio (23 commits)")

---

Tags

phpapiodoojson-rpc

### Embed Badge

![Health badge](/badges/winternet-studio-odoo-jsonrpc-client/health.svg)

```
[![Health](https://phpackages.com/badges/winternet-studio-odoo-jsonrpc-client/health.svg)](https://phpackages.com/packages/winternet-studio-odoo-jsonrpc-client)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k9.5M89](/packages/openai-php-laravel)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k409.0k6](/packages/theodo-group-llphant)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[resend/resend-php

Resend PHP library.

617.2M43](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M13](/packages/checkout-checkout-sdk-php)

PHPackages © 2026

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