Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] fastapi: Migration to 17.0 #409

Merged
merged 12 commits into from
Jun 6, 2024
Merged
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ exclude: |
^datamodel/|
^extendable/|
^extendable_fastapi/|
^fastapi/|
^fastapi_auth_jwt/|
^fastapi_auth_jwt_demo/|
^graphql_base/|
Expand Down
2,610 changes: 1,352 additions & 1,258 deletions fastapi/README.rst

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions fastapi/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Odoo FastAPI",
"summary": """
Odoo FastAPI endpoint""",
"version": "16.0.1.2.1",
"version": "17.0.1.0.0",
"license": "LGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"maintainers": ["lmignon"],
Expand All @@ -30,5 +30,5 @@
]
},
"development_status": "Beta",
"installable": False,
"installable": True,
}
19 changes: 13 additions & 6 deletions fastapi/fastapi_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,24 @@
self.headers = dict(headers_tuple)

def _get_environ(self):
environ = self.request.httprequest.environ
environ["wsgi.input"] = self.request.httprequest._get_stream_for_parsing()
try:
# normal case after
# https://github.com/odoo/odoo/commit/cb1d057dcab28cb0b0487244ba99231ee292502e
httprequest = self.request.httprequest._HTTPRequest__wrapped
except AttributeError:

Check warning on line 49 in fastapi/fastapi_dispatcher.py

View check run for this annotation

Codecov / codecov/patch

fastapi/fastapi_dispatcher.py#L49

Added line #L49 was not covered by tests
# fallback for older odoo versions
# The try except is the most efficient way to handle this
# as we expect that most of the time the attribute will be there
# and this code will no more be executed if it runs on an up to
# date odoo version. (EAFP: Easier to Ask for Forgiveness than Permission)
httprequest = self.request.httprequest

Check warning on line 55 in fastapi/fastapi_dispatcher.py

View check run for this annotation

Codecov / codecov/patch

fastapi/fastapi_dispatcher.py#L55

Added line #L55 was not covered by tests
environ = httprequest.environ
environ["wsgi.input"] = httprequest._get_stream_for_parsing()
return environ

@contextmanager
def _manage_odoo_env(self, uid=None):
env = request.env
# add authenticated_partner_id=False in the context
# to ensure that the ir.rule defined for user's endpoint can be
# evaluated even if not authenticated partner is set
env = env(context=dict(env.context, authenticated_partner_id=False))
accept_language = request.httprequest.headers.get("Accept-language")
context = env.context
if accept_language:
Expand Down
243 changes: 243 additions & 0 deletions fastapi/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * fastapi
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-15 17:34+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: fastapi
#: model:ir.model.fields,help:fastapi.field_fastapi_endpoint__description
msgid "A short description of the API. It can use Markdown"
msgstr "Una breve descrizione dell'API. Può contenere Markdown"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__active
msgid "Active"
msgstr "Attivo"

#. module: fastapi
#: model:res.groups,name:fastapi.group_fastapi_manager
msgid "Administrator"
msgstr "Amministratore"

#. module: fastapi
#: model:ir.model.fields.selection,name:fastapi.selection__fastapi_endpoint__demo_auth_method__api_key
msgid "Api Key"
msgstr "Chiave API"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__app
#: model_terms:ir.ui.view,arch_db:fastapi.fastapi_endpoint_search_view
msgid "App"
msgstr "Applicazione"

#. module: fastapi
#: model_terms:ir.ui.view,arch_db:fastapi.fastapi_endpoint_form_view
#: model_terms:ir.ui.view,arch_db:fastapi.fastapi_endpoint_search_view
msgid "Archived"
msgstr "In archivio"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__demo_auth_method
msgid "Authenciation method"
msgstr "Metodo autenticazione"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__company_id
msgid "Company"
msgstr "Azienda"

#. module: fastapi
#: model_terms:ir.ui.view,arch_db:fastapi.fastapi_endpoint_demo_form_view
msgid "Configuration"
msgstr "Configurazione"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__create_uid
msgid "Created by"
msgstr "Creato da"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__create_date
msgid "Created on"
msgstr "Creato il"

#. module: fastapi
#: model:ir.model.fields.selection,name:fastapi.selection__fastapi_endpoint__app__demo
msgid "Demo Endpoint"
msgstr "Endpoint esempio"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__description
msgid "Description"
msgstr "Descrizione"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__docs_url
msgid "Docs Url"
msgstr "URL documenti"

#. module: fastapi
#: model:ir.module.category,name:fastapi.module_category_fastapi
#: model:ir.ui.menu,name:fastapi.menu_fastapi_root
msgid "FastAPI"
msgstr "FastAPI"

#. module: fastapi
#: model:ir.actions.act_window,name:fastapi.fastapi_endpoint_act_window
#: model:ir.model,name:fastapi.model_fastapi_endpoint
#: model:ir.ui.menu,name:fastapi.fastapi_endpoint_menu
msgid "FastAPI Endpoint"
msgstr "Endopoint FastAPI"

#. module: fastapi
#: model:res.groups,name:fastapi.group_fastapi_endpoint_runner
msgid "FastAPI Endpoint Runner"
msgstr "Esecutore endopoint FastAPI"

#. module: fastapi
#: model_terms:ir.ui.view,arch_db:fastapi.fastapi_endpoint_search_view
msgid "Group by..."
msgstr "Raggruppa per..."

#. module: fastapi
#: model:ir.model.fields.selection,name:fastapi.selection__fastapi_endpoint__demo_auth_method__http_basic
msgid "HTTP Basic"
msgstr "Base HTTP"

#. module: fastapi
#: model:ir.module.category,description:fastapi.module_category_fastapi
msgid "Helps you manage your Fastapi Endpoints"
msgstr "Aiuta nella gestione degli endpoint FastAPI"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__id
msgid "ID"
msgstr "ID"

#. module: fastapi
#: model:ir.model,name:fastapi.model_res_lang
msgid "Languages"
msgstr "Lingue"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__write_uid
msgid "Last Updated by"
msgstr "Ultimo aggiornamento di"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__write_date
msgid "Last Updated on"
msgstr "Ultimo aggiornamento il"

#. module: fastapi
#: model:res.groups,name:fastapi.my_demo_app_group
msgid "My Demo Endpoint Group"
msgstr "Il mio gruppo endpoint esempio"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__name
msgid "Name"
msgstr "Nome"

#. module: fastapi
#: model:ir.model.fields,help:fastapi.field_fastapi_endpoint__registry_sync
msgid ""
"ON: the record has been modified and registry was not notified.\n"
"No change will be active until this flag is set to false via proper action.\n"
"\n"
"OFF: record in line with the registry, nothing to do."
msgstr ""
"Acceso: il record è stato modificato e il registro non è stato notificato.\n"
"Nessuna modifica sarà attiva finchè questa opzione è impostata a falso "
"attraverso un'azione opportuna.\n"
"\n"
"Spento: record allineato con il registro, non c'è niente da fare."

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__openapi_url
msgid "Openapi Url"
msgstr "URL OpenAPI"

#. module: fastapi
#: model:ir.model,name:fastapi.model_ir_rule
msgid "Record Rule"
msgstr "Regola su record"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__redoc_url
msgid "Redoc Url"
msgstr "URL record"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__registry_sync
msgid "Registry Sync"
msgstr "Sincro registro"

#. module: fastapi
#: model_terms:ir.ui.view,arch_db:fastapi.fastapi_endpoint_form_view
msgid "Registry Sync Required"
msgstr "Sincro registro richiesto"

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__root_path
msgid "Root Path"
msgstr "Percorso radice"

#. module: fastapi
#: model:ir.actions.server,name:fastapi.fastapi_endpoint_action_sync_registry
#: model_terms:ir.ui.view,arch_db:fastapi.fastapi_endpoint_form_view
#: model_terms:ir.ui.view,arch_db:fastapi.fastapi_endpoint_tree_view
msgid "Sync Registry"
msgstr "Sincronizza registro"

#. module: fastapi
#. odoo-python
#: code:addons/fastapi/models/fastapi_endpoint_demo.py:0
#, python-format
msgid "The authentication method is required for app %(app)s"
msgstr "Il metodo di autenticazione è richiesto per l'app %(app)s"

#. module: fastapi
#: model:ir.model.fields,help:fastapi.field_fastapi_endpoint__name
msgid "The title of the API."
msgstr "Titolo dell'API."

#. module: fastapi
#: model:ir.model.fields,help:fastapi.field_fastapi_endpoint__user_id
msgid "The user to use to execute the API calls."
msgstr "Utente da utilizzare per eseguire la chiamata API."

#. module: fastapi
#: model:ir.model.fields,field_description:fastapi.field_fastapi_endpoint__user_id
#: model:res.groups,name:fastapi.group_fastapi_user
msgid "User"
msgstr "Utente"

#. module: fastapi
#. odoo-python
#: code:addons/fastapi/models/fastapi_endpoint.py:0
#, python-format
msgid "`%(name)s` uses a blacklisted root_path = `%(root_path)s`"
msgstr "`%(name)s` utilizza un root_path bloccato = `%(root_path)s`"
Loading
Loading