Skip to content

Commit

Permalink
Merge PR #442 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by lmignon
  • Loading branch information
OCA-git-bot committed Oct 1, 2024
2 parents 4b9b18f + 1aff5c5 commit 8774d0b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions fastapi/models/fastapi_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -178,6 +188,7 @@ def _get_routing_info(self):
f"{self.root_path}/",
f"{self.root_path}/<path:application_path>",
],
"save_session": self.save_http_session,
# csrf ?????
}

Expand Down
1 change: 1 addition & 0 deletions fastapi/readme/newsfragments/442.feature
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions fastapi/views/fastapi_endpoint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<field name="user_id" />
<field name="company_id" />
<field name="description" />
<field name="save_http_session" />
</group>
<group name="resoures">
<field name="docs_url" widget="url" />
Expand Down

0 comments on commit 8774d0b

Please sign in to comment.