Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Odooly

on:
push:
branches: [ "master" ]
branches: [ "master", "dev" ]
pull_request:
branches: [ "master" ]
branches: [ "master", "dev" ]

jobs:
build:
Expand Down
18 changes: 16 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,22 @@ Changelog
2.x.x (unreleased)
~~~~~~~~~~~~~~~~~~

* Use a Web session for JSON-RPC requests
when Requests is installed.
* Support webclient :class:`WebAPI` protocol as an alternative:
``/web/dataset/*``, ``/web/database/*``, ...
Webclient API is stable since Odoo 9.0

* Authenticate with ``/web/session/authenticate`` by default
and retrieve :attr:`Env.session_info`, with Odoo >= 9.0.

* Use Webclient API by default when ``protocol`` is not set.
It is same as setting ``protocol = web``

* New function :meth:`Client.drop_database`.

* New functions to create/destroy a session:
:meth:`Env.session_authenticate` and :meth:`Env.session_destroy`.

* Drop support for Python 3.5


2.2.1 (2025-09-24)
Expand Down
23 changes: 12 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Download and install the latest release::
:local:
:backlinks: top

Documentation and tutorial: http://odooly.readthedocs.org
Documentation and tutorial: https://odooly.readthedocs.io/


Overview
--------

Odooly carries three completing uses:
Odooly carries three modes of use:

(1) with command line arguments
(2) as an interactive shell
Expand All @@ -25,14 +25,15 @@ Odooly carries three completing uses:

Key features:

- provides an API very close to the Odoo API, through JSON-RPC and XML-RPC
- provides an API similar to Odoo Model, through Webclient API
- compatible with OpenERP 6.1 through Odoo 19.0
- single executable ``odooly.py``, no external dependency
- supports external APIs JSON-RPC and XML-RPC as alternative
- single file ``odooly.py``, no external dependency
- helpers for ``search``, for data model introspection, etc...
- simplified syntax for search ``domain`` and ``fields``
- full API accessible on the ``Client.env`` environment
- the module can be imported and used as a library: ``from odooly import Client``
- supports Python 3.5 and above
- simplified syntax for search ``domain``
- entire API accessible on the ``Client.env`` environment
- can be imported and used as a library: ``from odooly import Client``
- supports Python 3.6 and more recent



Expand All @@ -59,7 +60,7 @@ Although it is quite limited::
-c CONFIG, --config=CONFIG
specify alternate config file (default: 'odooly.ini')
--server=SERVER full URL of the server (default:
http://localhost:8069/xmlrpc)
http://localhost:8069/web)
-d DB, --db=DB database
-u USER, --user=USER username
-p PASSWORD, --password=PASSWORD
Expand Down Expand Up @@ -113,7 +114,7 @@ Edit ``odooly.ini`` and declare the environment(s)::
[demo]
username = demo
password = demo
protocol = xmlrpc
protocol = web

[demo_jsonrpc]
username = demo
Expand Down Expand Up @@ -164,6 +165,6 @@ This is a sample session::

.. note::

To preserve the history of commands when closing the session, first
To preserve the commands' history when closing the session, first
create an empty file in your home directory:
``touch ~/.odooly_history``
98 changes: 84 additions & 14 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ The library provides few objects to access the Odoo model and the
associated services of `the Odoo API`_.

The signature of the methods mimics the standard methods provided by the
:class:`osv.Model` Odoo class. This is intended to help the developer when
developping addons. What is experimented at the interactive prompt should
be portable in the application with little effort.
:class:`odoo.models.Model` Odoo class. This is intended to help the developer
when developping addons. What is experimented at the interactive prompt
should be portable in the application with little effort.

.. contents::
:local:
Expand All @@ -21,9 +21,10 @@ be portable in the application with little effort.
Client and Services
-------------------

The :class:`Client` object provides thin wrappers around Odoo RPC services
and their methods. Additional helpers are provided to explore the models and
list or install Odoo add-ons.
The :class:`Client` object provides thin wrappers around Odoo Webclient API
and RPC services and their methods. Additional helpers are provided on the
``Client.env`` environment, to explore the models and to list or to install
Odoo add-ons. Please refer to :class:`Env` documentation below.


.. autoclass:: Client
Expand All @@ -34,8 +35,14 @@ list or install Odoo add-ons.

.. automethod:: Client.clone_database

.. automethod:: Client.drop_database

.. automethod:: Client.login

.. attribute:: Client.env

Current :class:`Env` environment of the client.


.. note::

Expand All @@ -50,16 +57,53 @@ list or install Odoo add-ons.
``ODOOLY_SSL_UNVERIFIED=1``.


Odoo Webclient API
~~~~~~~~~~~~~~~~~~

These HTTP routes were developed for the Odoo Web application. They are used
by Odooly to provide high level methods on :class:`Env` and :class:`Model`.
The :attr:`~Client.database` endpoint exposes few methods which might be helpful
for database management. Use :func:`dir` function to introspect them.

.. attribute:: Client.database

Expose the ``database`` :class:`WebAPI`.

Example: :meth:`Client.database.list` method.

.. attribute:: Client.web

Expose the root ``/web`` :class:`WebAPI`.

.. attribute:: Client.web_dataset

Expose the ``/web/dataset`` :class:`WebAPI`.

.. attribute:: Client.web_session

Expose the ``/web/session`` :class:`WebAPI`.

.. attribute:: Client.web_webclient

Expose the ``/web/webclient`` :class:`WebAPI`.


Odoo RPC Services
~~~~~~~~~~~~~~~~~

The naked Odoo RPC services are exposed too.
The :attr:`~Client.db` and the :attr:`~Client.common` services expose few
.. note::

These RPC services are deprecated in Odoo 19.0. They are
scheduled for removal in Odoo 20.0.

The Odoo RPC services are exposed too. They could be used for server and
database operations.
The :attr:`~Client.db` and the :attr:`~Client.common` services provided
methods which might be helpful for server administration. Use the
:func:`dir` function to introspect them. The :attr:`~Client._object`
service should not be used directly because its methods are wrapped and
exposed on the :class:`Env` object itself.
The two last services are deprecated and removed in recent versions of Odoo.
service should not be used directly. It provides same feature as the
:attr:`~Client.web_dataset` Webclient endpoint. Use :class:`Env` and :class:`Model`
instead.
Please refer to `the Odoo documentation`_ for more details.


Expand All @@ -70,16 +114,22 @@ Please refer to `the Odoo documentation`_ for more details.
Examples: :meth:`Client.db.list` or :meth:`Client.db.server_version`
RPC methods.

Removed in Odoo 20.

.. attribute:: Client.common

Expose the ``common`` :class:`Service`.

Example: :meth:`Client.common.login_message` RPC method.

Removed in Odoo 20.

.. data:: Client._object

Expose the ``object`` :class:`Service`.

Removed in Odoo 20.

.. attribute:: Client._report

Expose the ``report`` :class:`Service`.
Expand All @@ -92,12 +142,16 @@ Please refer to `the Odoo documentation`_ for more details.

Removed in OpenERP 7.

.. autoclass:: WebAPI
:members:
:undoc-members:

.. autoclass:: Service
:members:
:undoc-members:

.. _the Odoo documentation:
.. _the Odoo API: http://doc.odoo.com/v6.1/developer/12_api.html#api
.. _the Odoo API: https://www.odoo.com/documentation/19.0/developer/reference/external_rpc_api.html


Environment
Expand Down Expand Up @@ -131,6 +185,16 @@ Environment

Cursor on the current database.

.. automethod:: session_authenticate

.. automethod:: session_destroy

.. attribute:: session_info

Dictionary returned when a Webclient session is authenticated.
It contains ``uid`` and ``user_context`` among other user's preferences
and server parameters.

.. automethod:: sudo(user=SUPERUSER_ID)


Expand All @@ -151,6 +215,12 @@ Please refer to `the Odoo documentation`_ for details.

.. automethod:: Env.execute(obj, method, *params, **kwargs)

.. automethod:: Env._call_kw(obj, method, *params, **kwargs)

.. attribute:: Env._web(obj, method, *params, **kwargs)

Expose the root of the ``/web`` API.

.. method:: Env.exec_workflow(obj, signal, obj_id)

Wrapper around ``object.exec_workflow`` RPC method.
Expand Down Expand Up @@ -212,7 +282,7 @@ Python script or interactively in a Python session.
It is not recommended to install or upgrade modules in offline mode when
any web server is still running: the operation will not be signaled to
other processes. This restriction does not apply when connected through
XML-RPC or JSON-RPC.
Webclient API or other RPC API.


.. _model-and-records:
Expand All @@ -222,7 +292,7 @@ Model and Records

The :class:`Env` provides a high level API similar to the Odoo API, which
encapsulates objects into `Active Records
<http://www.martinfowler.com/eaaCatalog/activeRecord.html>`_.
<https://www.martinfowler.com/eaaCatalog/activeRecord.html>`_.

The :class:`Model` is instantiated using the ``client.env[...]`` syntax.

Expand Down
11 changes: 6 additions & 5 deletions docs/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ complex tasks.
For example:

* write unit tests using the standard `unittest
<http://docs.python.org/library/unittest.html>`_ framework.
* write BDD tests using the `Gherkin language <http://packages.python.org/
behave/gherkin.html#gherkin-feature-testing-language>`_, and a library
like `Behave <http://packages.python.org/behave/>`_.
<https://docs.python.org/library/unittest.html>`_ framework.
* write BDD tests using the `Gherkin language <https://behave.readthedocs.io/
en/latest/gherkin/#gherkin-feature-testing-language>`_, and a library
like `Behave <https://behave.readthedocs.io/>`_.
* build an interface for Odoo, using a framework like
`Flask <http://flask.pocoo.org/>`_ (HTML, JSON, SOAP, ...).
`Flask <https://flask.palletsprojects.com/>`_ (HTML, JSON, SOAP, ...).



Changes
Expand Down
10 changes: 5 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Odooly's documentation
*A versatile tool for browsing Odoo / OpenERP data*

The Odooly library communicates with any `Odoo / OpenERP server`_ (>= 6.1)
using `the standard XML-RPC interface`_ or the new JSON-RPC interface.
using the Webclient API or `the deprecated external RPC interface`_ (JSON-RPC or XML-RPC).

It provides both a :ref:`fully featured low-level API <client-and-services>`,
and an encapsulation of the methods on :ref:`Active Record objects
<model-and-records>`. It implements the Odoo API 8.0.
<model-and-records>`. It implements the Odoo API.
Additional helpers are provided to explore the model and administrate the
server remotely.

Expand All @@ -35,11 +35,11 @@ Contents:
tutorial
developer

* Online documentation: http://odooly.readthedocs.org/
* Online documentation: https://odooly.readthedocs.io/
* Source code and issue tracker: https://github.com/tinyerp/odooly

.. _Odoo / OpenERP server: http://doc.odoo.com/
.. _the standard XML-RPC interface: http://doc.odoo.com/v6.1/developer/12_api.html#api
.. _Odoo / OpenERP server: https://www.odoo.com/documentation/
.. _the deprecated external RPC interface: https://www.odoo.com/documentation/19.0/developer/reference/external_rpc_api.html


Indices and tables
Expand Down
2 changes: 1 addition & 1 deletion docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Installation
------------

Download and install the `latest release
<http://pypi.python.org/pypi/Odooly>`__ from PyPI::
<https://pypi.org/project/Odooly>`__ from PyPI::

pip install -U odooly

Expand Down
Loading