From 3fa322bc0fd577a260800cde0944180e9c06b4aa Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 3 Oct 2024 06:19:02 +0000 Subject: [PATCH] [BOT] post-merge updates --- README.md | 2 +- fastapi/README.rst | 40 +++++++- fastapi/__manifest__.py | 2 +- fastapi/readme/HISTORY.md | 33 +++++++ fastapi/readme/newsfragments/422.bugfix | 25 ----- fastapi/static/description/index.html | 117 ++++++++++++++++-------- 6 files changed, 153 insertions(+), 66 deletions(-) delete mode 100644 fastapi/readme/newsfragments/422.bugfix diff --git a/README.md b/README.md index 46f428e9a..ea8f15700 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Available addons ---------------- addon | version | maintainers | summary --- | --- | --- | --- -[fastapi](fastapi/) | 17.0.1.0.1 | [![lmignon](https://github.com/lmignon.png?size=30px)](https://github.com/lmignon) | Odoo FastAPI endpoint +[fastapi](fastapi/) | 17.0.2.0.0 | [![lmignon](https://github.com/lmignon.png?size=30px)](https://github.com/lmignon) | Odoo FastAPI endpoint Unported addons diff --git a/fastapi/README.rst b/fastapi/README.rst index 6d2a41ef7..95136a9e8 100644 --- a/fastapi/README.rst +++ b/fastapi/README.rst @@ -7,7 +7,7 @@ Odoo FastAPI !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:9055545c121160a5d96e27ac9509e54c04c2202efa16d88aad8f18404765ad60 + !! source digest: sha256:d2ae440ec28b3fd00f7d376f77aa07f991b6348b3623cefeb8a3645ced69e963 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -1471,6 +1471,44 @@ WebSockets and to stream large responses. Changelog ========= +17.0.2.0.0 (2024-10-03) +----------------------- + +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 `__) + 17.0.1.0.1 (2024-10-02) ----------------------- diff --git a/fastapi/__manifest__.py b/fastapi/__manifest__.py index 118ac42e2..c983c9a1c 100644 --- a/fastapi/__manifest__.py +++ b/fastapi/__manifest__.py @@ -5,7 +5,7 @@ "name": "Odoo FastAPI", "summary": """ Odoo FastAPI endpoint""", - "version": "17.0.1.0.1", + "version": "17.0.2.0.0", "license": "LGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "maintainers": ["lmignon"], diff --git a/fastapi/readme/HISTORY.md b/fastapi/readme/HISTORY.md index e1a185efa..2fabd111c 100644 --- a/fastapi/readme/HISTORY.md +++ b/fastapi/readme/HISTORY.md @@ -1,3 +1,36 @@ +## 17.0.2.0.0 (2024-10-03) + +### 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)) + + ## 17.0.1.0.1 (2024-10-02) ### Bugfixes diff --git a/fastapi/readme/newsfragments/422.bugfix b/fastapi/readme/newsfragments/422.bugfix deleted file mode 100644 index 1d71cd568..000000000 --- a/fastapi/readme/newsfragments/422.bugfix +++ /dev/null @@ -1,25 +0,0 @@ -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. diff --git a/fastapi/static/description/index.html b/fastapi/static/description/index.html index a39ccf7d3..b21e4cea3 100644 --- a/fastapi/static/description/index.html +++ b/fastapi/static/description/index.html @@ -367,7 +367,7 @@

Odoo FastAPI

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:9055545c121160a5d96e27ac9509e54c04c2202efa16d88aad8f18404765ad60 +!! source digest: sha256:d2ae440ec28b3fd00f7d376f77aa07f991b6348b3623cefeb8a3645ced69e963 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: LGPL-3 OCA/rest-framework Translate me on Weblate Try me on Runboat

This addon provides the basis to smoothly integrate the @@ -437,37 +437,41 @@

Odoo FastAPI

  • Known issues / Roadmap
  • Changelog