diff --git a/fastapi/models/fastapi_endpoint.py b/fastapi/models/fastapi_endpoint.py index a7608e27b..1312f07d1 100644 --- a/fastapi/models/fastapi_endpoint.py +++ b/fastapi/models/fastapi_endpoint.py @@ -55,6 +55,16 @@ class FastapiEndpoint(models.Model): readonly=False, domain="[('user_ids', 'in', user_id)]", ) + save_http_session = fields.Boolean( + string="Save HTTP Session", + help="Whether session should be saved into the session store. This is " + "required if for example you use the Odoo's authentication mechanism. " + "Oherwise chance are high that you don't need it and could turn off " + "this behaviour. Additionaly turning off this option will prevent useless " + "IO operation when storing and reading the session on the disk and prevent " + "unexpecteed disk space consumption.", + default=True, + ) @api.depends("root_path") def _compute_root_path(self): @@ -178,6 +188,7 @@ def _get_routing_info(self): f"{self.root_path}/", f"{self.root_path}/", ], + "save_session": self.save_http_session, # csrf ????? } diff --git a/fastapi/readme/newsfragments/442.feature b/fastapi/readme/newsfragments/442.feature new file mode 100644 index 000000000..f45f73ebf --- /dev/null +++ b/fastapi/readme/newsfragments/442.feature @@ -0,0 +1 @@ +* 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. diff --git a/fastapi/views/fastapi_endpoint.xml b/fastapi/views/fastapi_endpoint.xml index e4a6c28c8..6a6ede3fb 100644 --- a/fastapi/views/fastapi_endpoint.xml +++ b/fastapi/views/fastapi_endpoint.xml @@ -46,6 +46,7 @@ +