Initial commit: OCA Technical packages (595 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:03 +02:00
commit 2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions

View file

@ -0,0 +1 @@
* Laurent Mignon <laurent.mignon@acsone.eu>

View file

@ -0,0 +1,38 @@
This addon provides the basis to smoothly integrate the `FastAPI`_
framework into Odoo.
This integration allows you to use all the goodies from `FastAPI`_ to build custom
APIs for your Odoo server based on standard Python type hints.
**What is building an API?**
An API is a set of functions that can be called from the outside world. The
goal of an API is to provide a way to interact with your application from the
outside world without having to know how it works internally. A common mistake
when you are building an API is to expose all the internal functions of your
application and therefore create a tight coupling between the outside world and
your internal datamodel and business logic. This is not a good idea because it
makes it very hard to change your internal datamodel and business logic without
breaking the outside world.
When you are building an API, you define a contract between the outside world
and your application. This contract is defined by the functions that you expose
and the parameters that you accept. This contract is the API. When you change
your internal datamodel and business logic, you can still keep the same API
contract and therefore you don't break the outside world. Even if you change
your implementation, as long as you keep the same API contract, the outside
world will still work. This is the beauty of an API and this is why it is so
important to design a good API.
A good API is designed to be stable and to be easy to use. It's designed to
provide high-level functions related to a specific use case. It's designed to
be easy to use by hiding the complexity of the internal datamodel and business
logic. A common mistake when you are building an API is to expose all the internal
functions of your application and let the oustide world deal with the complexity
of your internal datamodel and business logic. Don't forget that on a transactional
point of view, each call to an API function is a transaction. This means that
if a specific use case requires multiple calls to your API, you should provide
a single function that does all the work in a single transaction. This why APIs
methods are called high-level and atomic functions.
.. _FastAPI: https://fastapi.tiangolo.com/

View file

@ -0,0 +1,127 @@
16.0.1.4.3 (2024-10-01)
~~~~~~~~~~~~~~~~~~~~~~~
**Features**
- * A new parameter is now available on the endpoint model to let you disable the creation and the store of session files used by Odoo for calls to your application endpoint. This is usefull to prevent disk space consumption and IO operations if your application doesn't need to use this sessions files which are mainly used by Odoo by to store the session info of logged in users. (`#442 <https://github.com/OCA/rest-framework/issues/442>`_)
16.0.1.4.1 (2024-07-08)
~~~~~~~~~~~~~~~~~~~~~~~
**Bugfixes**
- Fix issue with the retry of a POST request with a body content.
Prior to this fix the retry of a POST request with a body content would
stuck in a loop and never complete. This was due to the fact that the
request input stream was not reset after a failed attempt to process the
request. (`#440 <https://github.com/OCA/rest-framework/issues/440>`_)
16.0.1.4.0 (2024-06-06)
~~~~~~~~~~~~~~~~~~~~~~~
**Bugfixes**
- This change is a complete rewrite of the way the transactions are managed when
integrating a fastapi application into Odoo.
In the previous implementation, specifics error handlers were put in place to
catch exception occurring in the handling of requests made to a fastapi application
and to rollback the transaction in case of error. This was done by registering
specifics error handlers methods to the fastapi application using the 'add_exception_handler'
method of the fastapi application. In this implementation, the transaction was
rolled back in the error handler method.
This approach was not working as expected for several reasons:
- The handling of the error at the fastapi level prevented the retry mechanism
to be triggered in case of a DB concurrency error. This is because the error
was catch at the fastapi level and never bubbled up to the early stage of the
processing of the request where the retry mechanism is implemented.
- The cleanup of the environment and the registry was not properly done in case
of error. In the **'odoo.service.model.retrying'** method, you can see that
the cleanup process is different in case of error raised by the database
and in case of error raised by the application.
This change fix these issues by ensuring that errors are no more catch at the
fastapi level and bubble up the fastapi processing stack through the event loop
required to transform WSGI to ASGI. As result the transactional nature of the
requests to the fastapi applications is now properly managed by the Odoo framework. (`#422 <https://github.com/OCA/rest-framework/issues/422>`_)
16.0.1.2.6 (2024-02-20)
~~~~~~~~~~~~~~~~~~~~~~~
**Bugfixes**
- Fix compatibility issues with the latest Odoo version
From https://github.com/odoo/odoo/commit/cb1d057dcab28cb0b0487244ba99231ee292502e
the original werkzeug HTTPRequest class has been wrapped in a new class to keep
under control the attributes developers use. This changes take care of this
new implementation but also keep compatibility with the old ones. (`#414 <https://github.com/OCA/rest-framework/issues/414>`_)
16.0.1.2.5 (2024-01-17)
~~~~~~~~~~~~~~~~~~~~~~~
**Bugfixes**
- Odoo has done an update and now, it checks domains of ir.rule on creation and modification.
The ir.rule 'Fastapi: Running user rule' uses a field (authenticate_partner_id) that comes from the context.
This field wasn't always set and this caused an error when Odoo checked the domain.
So now it is set to *False* by default. (`#410 <https://github.com/OCA/rest-framework/issues/410>`_)
16.0.1.2.3 (2023-12-21)
~~~~~~~~~~~~~~~~~~~~~~~
**Bugfixes**
- In case of exception in endpoint execution, close the database cursor after rollback.
This is to ensure that the *retrying* method in *service/model.py* does not try
to flush data to the database. (`#405 <https://github.com/OCA/rest-framework/issues/405>`_)
16.0.1.2.2 (2023-12-12)
~~~~~~~~~~~~~~~~~~~~~~~
**Bugfixes**
- When using the 'FastAPITransactionCase' class, allows to specify a specific
override of the 'authenticated_partner_impl' method into the list of
overrides to apply. Before this change, the 'authenticated_partner_impl'
override given in the 'overrides' parameter was always overridden in the
'_create_test_client' method of the 'FastAPITransactionCase' class. It's now
only overridden if the 'authenticated_partner_impl' method is not already
present in the list of overrides to apply and no specific partner is given.
If a specific partner is given at same time of an override for the
'authenticated_partner_impl' method, an error is raised. (`#396 <https://github.com/OCA/rest-framework/issues/396>`_)
16.0.1.2.1 (2023-11-03)
~~~~~~~~~~~~~~~~~~~~~~~
**Bugfixes**
- Fix a typo in the Field declaration of the 'count' attribute of the 'PagedCollection' schema.
Misspelt parameter was triggering a deprecation warning due to recent versions of Pydantic seeing it as an arbitrary parameter. (`#389 <https://github.com/OCA/rest-framework/issues/389>`_)
16.0.1.2.0 (2023-10-13)
~~~~~~~~~~~~~~~~~~~~~~~
**Features**
- The field *total* in the *PagedCollection* schema is replaced by the field *count*.
The field *total* is now deprecated and will be removed in the next major version.
This change is backward compatible. The json document returned will now
contain both fields *total* and *count* with the same value. In your python
code the field *total*, if used, will fill the field *count* with the same
value. You are encouraged to use the field *count* instead of *total* and adapt
your code accordingly. (`#380 <https://github.com/OCA/rest-framework/issues/380>`_)

View file

@ -0,0 +1,10 @@
The `roadmap <https://github.com/OCA/rest-framework/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement+label%3Afastapi>`_
and `known issues <https://github.com/OCA/rest-framework/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afastapi>`_ can
be found on GitHub.
The **FastAPI** module provides an easy way to use WebSockets. Unfortunately, this
support is not 'yet' available in the **Odoo** framework. The challenge is high
because the integration of the fastapi is based on the use of a specific middleware
that convert the WSGI request consumed by odoo to a ASGI request. The question
is to know if it is also possible to develop the same kind of bridge for the
WebSockets and to stream large responses.

File diff suppressed because it is too large Load diff