{"id":16669225,"url":"https://github.com/katyukha/odoo-rpc-client","last_synced_at":"2025-03-23T14:31:31.808Z","repository":{"id":54583578,"uuid":"78747888","full_name":"katyukha/odoo-rpc-client","owner":"katyukha","description":"Odoo RPC client Library.","archived":false,"fork":false,"pushed_at":"2022-09-14T19:33:33.000Z","size":641,"stargazers_count":30,"open_issues_count":1,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T21:15:58.880Z","etag":null,"topics":["cli","client","odoo","openerp","python","rpc"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/odoo_rpc_client","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katyukha.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-12T13:26:00.000Z","updated_at":"2024-08-02T04:24:48.000Z","dependencies_parsed_at":"2023-01-18T08:00:46.679Z","dependency_job_id":null,"html_url":"https://github.com/katyukha/odoo-rpc-client","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyukha%2Fodoo-rpc-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyukha%2Fodoo-rpc-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyukha%2Fodoo-rpc-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyukha%2Fodoo-rpc-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katyukha","download_url":"https://codeload.github.com/katyukha/odoo-rpc-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245115888,"owners_count":20563252,"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":["cli","client","odoo","openerp","python","rpc"],"created_at":"2024-10-12T11:30:32.047Z","updated_at":"2025-03-23T14:31:31.085Z","avatar_url":"https://github.com/katyukha.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Odoo RPC Client\n===============\n\n\n.. image:: https://gitlab.com/katyukha/odoo-rpc-client/badges/master/pipeline.svg\n    :target: https://gitlab.com/katyukha/odoo-rpc-client/commits/master\n\n.. image:: https://gitlab.com/katyukha/odoo-rpc-client/badges/master/coverage.svg\n    :target: https://gitlab.com/katyukha/odoo-rpc-client/commits/master\n\n.. image:: https://img.shields.io/readthedocs/odoo-rpc-client.svg\n    :target: https://odoo-rpc-client.readthedocs.io/en/latest/\n\n.. image:: https://img.shields.io/pypi/dm/odoo-rpc-client.svg\n    :target: https://pypi.org/project/odoo-rpc-client/\n    :alt: PyPI - Downloads\n\n-------------------\n\n.. contents::\n   :depth: 2\n\n\nCanonical source\n----------------\n\nThe canonical source of *odoo-rpc-client* is hosted on `GitLab \u003chttps://gitlab.com/katyukha/odoo-rpc-client\u003e`__.\n\n\nOverview\n--------\n\nThis is core part of `OpenERP Proxy \u003chttps://github.com/katyukha/openerp-proxy\u003e`__\n\nThis project is just **RPC client** for Odoo.\nThis project provides interface similar to\nOdoo internal code to perform operations on **Odoo** objects hiding\n**XML-RPC** or **JSON-RPC** behind.\n\n\nFeatures\n~~~~~~~~\n\n-  *Python 3.5+* support\n-  You can call any public method on any OpenERP / Odoo object including:\n   *read*, *search*, *write*, *unlink* and others\n-  Have *a lot of speed optimizations* (caching, read only requested fields,\n   read data for all records in current set (cache), by one RPC call, etc)\n-  Desinged to take as more benefits of **IPython autocomplete** as posible\n-  Provides *browse\\_record* like interface, allowing to browse related\n   models too. Supports `browse` method.\n   Also adds method `search_records` to simplify\n   search-and-read operations.\n-  *Extension support*. You can easily modify most of components of this lib\n   creating Your own extensions and plugins. It is realy simple. See for examples in\n   `openerp_proxy/ext/ \u003chttps://github.com/katyukha/openerp-proxy/tree/master/openerp_proxy/ext\u003e`__ directory.\n-  *Plugin Support*. Plugins are same as extensions, but aimed to implement additional logic.\n   For example look at `odoo_rpc_client/plugins \u003chttps://gitlab.com/katyukha/odoo-rpc-client/tree/master/odoo_rpc_client/plugins\u003e`__\n   and `odoo_rpc_client/plugin.py \u003chttps://gitlab.com/katyukha/odoo-rpc-client/blob/master/odoo_rpc_client/plugin.py\u003e`__ \n-  Support of **JSON-RPC** for *version 8+* of Odoo\n-  Support of using **named parametrs** in RPC method calls (server version 6.1 and higher).\n-  *Experimental* integration with `AnyField \u003chttps://pypi.python.org/pypi/anyfield\u003e`__\n-  Missed feature? fill and issue on `GitHub \u003chttps://github.com/katyukha/odoo-rpc-client/issues\u003e`__ or `GitLab  \u003chttps://gitlab.com/katyukha/odoo-rpc-client/issues\u003e`__\n\n\nQuick example\n~~~~~~~~~~~~~\n\n.. code:: python\n\n    from odoo_rpc_client import Client\n\n    # assume that odoo server is listening localhost on standard 8069 port and\n    # have database 'my_db'.\n    client = Client('localhost', 'my_db', 'user', 'password')\n\n    # get current user\n    client.user\n    print(client.user.name)\n\n    # simple rpc calls\n    client.execute('res.partner', 'read', [client.user.partner_id.id])\n\n    # Model browsing\n    SaleOrder = client['sale.order']\n    s_orders = SaleOrder.search_records([])\n    for order in s_orders:\n        print(order.name)\n        for line in order.order_line:\n            print(\"\\t%s\" % line.name)\n        print(\"-\" * 5)\n        print()\n\n\nSupported Odoo server versions\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTested with:\n- Odoo versions: *10.0*, *11.0*, *12.0*, *13.0*, *14.0*\n- Python versions: *2.7*, *3.5*, *3.6*, *3.7*, *3.8*, *3.9*\n\n\nInstall\n-------\n\nThis project is present on `PyPI \u003chttps://pypi.python.org/pypi/odoo_rpc_client/\u003e`__\nso it could be installed via PIP::\n\n    pip install odoo_rpc_client\n\nYodoo Cockpit - Manage your odoo infrastructure via odoo\n--------------------------------------------------------\n\n.. image:: https://crnd.pro/web/image/18846/banner_2_4_gif_animation_cut.gif\n  :target: https://crnd.pro/yodoo-cockpit\n  :alt: Yodoo Cockpit - Manage your odoo infrastructure via odoo\n\nTake a look at `Yodoo Cockpit \u003chttps://crnd.pro/yodoo-cockpit\u003e`__ project, and discover the easiest way to manage your odoo installation.\nJust short notes about `Yodoo Cockpit \u003chttps://crnd.pro/yodoo-cockpit\u003e`__:\n\n- start new production-ready odoo instance in 1-2 minutes.\n- add custom addons to your odoo instances in 5-10 minutes.\n- out-of-the-box email configuration: just press button and add some records to your DNS, and get a working email\n- make your odoo instance available to external world (internet) in 30 seconds (just add single record in your DNS)\n\nIf you have any questions, then contact us at `info@crnd.pro \u003cmailto:info@crnd.pro\u003e`__, so we could schedule online-demonstration.\n\nLevel up your service quality\n-----------------------------\n\nLevel up your service with our `Helpdesk \u003chttps://crnd.pro/solutions/helpdesk\u003e`__ / `Service Desk \u003chttps://crnd.pro/solutions/service-desk\u003e`__ / `ITSM \u003chttps://crnd.pro/itsm\u003e`__ solution.\n\nJust test it at `yodoo.systems \u003chttps://yodoo.systems/saas/templates\u003e`__: choose template you like, and start working.\n\nTest all available features of `Bureaucrat ITSM \u003chttps://crnd.pro/itsm\u003e`__ with `this template \u003chttps://yodoo.systems/saas/template/bureaucrat-itsm-demo-data-95\u003e`__.\n    \n\nUsage\n-----\n\nConnect to server / database\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe one diference betwen using as lib and using as shell is the way\nconnection to database is created. When using as shell the primary object\nis session, which provides some interactivity. But when using as library\nin most cases there are no need for that interactivity, so connection\nshould be created manualy, providing connection data from some other sources\nlike config file or something else.\n\nSo here is a way to create connection\n\n.. code:: python\n\n    from odoo_rpc_client import Client\n    db = Client(host='my_host.int',\n                dbname='my_db',\n                user='my_db_user',\n                pwd='my_password here')\n\nAnd next all there same, no more differences betwen shell and lib usage.\n\n\nGeneral usage\n~~~~~~~~~~~~~\n\nFor example lets try to find how many sale orders in 'done' state we have in\nour database. (Look above sections to get help on how to connect to Odoo database)\n\n.. code:: python\n\n    \u003e\u003e\u003e sale_order_obj = db['sale.order']  # or You may use 'db.get_obj('sale.order')' if You like\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e # Now lets search for sale orders:\n    \u003e\u003e\u003e sale_order_obj.search([('state', '=', 'done')], count=True)\n    5\n\nSo we have 5 orders in done state. So let's read them.\n\nDefault way to read data from Odoo is to search for required records\nwith *search* method which return's list of IDs of records, then read\ndata using *read* method. Both methods mostly same as Odoo internal\nones:\n\n.. code:: python\n\n    \u003e\u003e\u003e sale_order_ids = sale_order_obj.search([('state', '=', 'done')])\n    \u003e\u003e\u003e sale_order_datas = sale_order_obj.read(sale_order_ids, ['name'])  # Last argument is optional.\n                                                                          # it describes list of fields to read\n                                                                          # if it is not provided then all fields\n                                                                          # will be read\n    \u003e\u003e\u003e sale_order_datas[0]\n    {'id': 3,\n     'name': 'SO0004'\n    }\n\nAs we see reading data in such way allows us to get list of dictionaries\nwhere each contain fields have been read\n\nAnother way to read data is to use\n`search_records`\nor\n`read_lecords`\nmethod. Each of these methods receives same aguments as ``search`` or\n``read`` method respectively. But passing ``count`` argument for\n``search\\_records`` will cause error. Main difference betwen these methods\nin using `Record` class\ninstead of *dict* for each record had been read. Record class provides some orm-like abilities for records,\nallowing for example access fields as attributes and provide mechanisms\nto lazily fetch related fields.\n\n.. code:: python\n\n    \u003e\u003e\u003e sale_orders = sale_order_obj.search_records([('state', '=', 'done')])\n    \u003e\u003e\u003e sale_orders[0]\n    R(sale.order, 9)[SO0011]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e # So we have list of Record objects. Let's check what they are\n    \u003e\u003e\u003e so = sale_orders[0]\n    \u003e\u003e\u003e so.id\n    9\n    \u003e\u003e\u003e so.name\n    SO0011\n    \u003e\u003e\u003e so.partner_id\n    R(res.partner, 9)[Better Corp]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e so.partner_id.name\n    Better Corp\n    \u003e\u003e\u003e so.partner_id.active\n    True\n\n\nAdditional features\n-------------------\n\nPlugins\n~~~~~~~\n\nIn version 0.4 plugin system was completly refactored. At this version\nwe start using `extend_me \u003chttps://pypi.python.org/pypi/extend_me\u003e`__\nlibrary to build extensions and plugins easily.\n\nPlugins are usual classes that provides functionality that should be available\nat ``db.plugins.*`` point, implementing logic not related to core system.\n\n--------------\n\nFor more information see `source\ncode \u003chttps://gitlab.com/katyukha/odoo-rpc-client\u003e`__ and\n`documentation \u003chttps://odoo-rpc-client.readthedocs.io/en/latest/\u003e`__\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyukha%2Fodoo-rpc-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatyukha%2Fodoo-rpc-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyukha%2Fodoo-rpc-client/lists"}