Repository
OCA/storage · module folder · Try on Runboat
Module version
2.0.0
Category
Uncategorized
Folder size
0.19 MB
License
LGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/storage
Last tracking update
2026-08-07 09:06:25
Authors
ACSONE SA/NV, Odoo Community Association (OCA)
Maintainers
ACSONE SA/NV, Odoo Community Association (OCA)
Committers
Stéphane Bidoul, Laurent Mignon (ACSONE)
Odoo dependencies
OCA/server-env:
OCA/storage:
odoo/odoo:
Python dependencies
fsspec>=2024.5.0
System dependencies
None
Required by
fs_folder_demo, fs_folder_ms_drive, fs_folder_webdav
Description
If you need to link some specific models to a specific folder into an external filesystem and be able to manage the content of this folder from the model form view, this module is for you.

Code Analysis

Views touched (1)
XML IDNameModelTypeStatus
fs_storage_form_view fs.storage form Inherits fs_storage.fs_storage_form_view
HTTP endpoints (11)
Route(s)HandlerAuthTypeMethodsFlags
/fs_folder/add_folder/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.add_folder user json POST
/fs_folder/copy/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.copy_file user json POST
/fs_folder/delete/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.delete user json POST
/fs_folder/delete_folder/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.delete_folder user json POST
/fs_folder/get_children/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.get_children user json POST
/fs_folder/get_file/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.get_file user http GET
/fs_folder/initialize/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.initialize user json POST
/fs_folder/move/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.move_file user json POST
/fs_folder/rename/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.rename user json POST
/fs_folder/unlink_folder/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.unlink_folder user json POST
/fs_folder/upload/<string:res_model>/<int:res_id>/<string:field_name> FsFolderController.upload user json POST
Models touched (5)

New fields (0)

No new fields.

Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (12)
  • copy_item(self, res_id, res_model, field_name, path, new_path, recursive=False, **kwargs) -> None
    @api.model
    Copy the fs item :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :param path: the path of the item :param new_path: the new path of the item
  • create_folder(self, res_id, res_model, field_name, path, **kwargs) -> None
    @api.model
    Create a folder at the given path. :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :param path: the path of the folder to create
  • delete(self, res_id, res_model, field_name, path, recursive=False, **kwargs) -> None
    @api.model
    Delete the given item. :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :param path: the path of the item
  • get_children(self, res_id, res_model, field_name, path, **kwargs) -> <expr>
    @api.model
    Return the children of the given item. :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :param path: the path of the item :return: a list of children items
  • get_root(self, res_id, res_model, field_name, **kwargs) -> dict
    @api.model
    Return the root of the filesystem. :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :return: the root of the filesystem
  • get_url_for_download(self, res_id, res_model, field_name, path, **kwargs) -> str
    @api.model
    Return the preview url of the given item. :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :param path: the path of the item :return: the preview url
  • get_url_for_preview(self, res_id, res_model, field_name, path, **kwargs) -> str
    @api.model
    Return the preview url of the given item. :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :param path: the path of the item :return: the preview url
  • initialize_field_value(self, res_id, res_model, field_name, **kwargs) -> None
    @api.model
    Initialize the value of the field.
  • remove_field_value(self, res_id, res_model, field_name, **kwargs) -> None
    @api.model
    Delete the value of the field.
  • rename(self, res_id, res_model, field_name, path, new_path, **kwargs) -> None
    @api.model
    Rename the given item. :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :param name: the name of the item to rename :return: the new reference
  • update_content(self, res_id, res_model, field_name, path, file_data, **kwargs) -> None
    @api.model
    Update the content of the given item. :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :param path: the path of the item :param new_content: the new content of the item (b64 encoded)
  • upload_file(self, res_id, res_model, field_name, path, file_name, file_data, mimetype=None, **kwargs) -> None
    @api.model
    Upload a file to the given item. :param res_id: the id of the record containing the field :param res_model: the model of the record containing the field :param field_name: the name of the field :param parent_path: the path of the parent item :param name: the name of the file :param content: the content of the file (b64 encoded) :param mimetype: the mimetype of the file :return: the reference of the uploaded file

New fields (3)
  • fs_name_sanitization_replace_char Char
    default='_' help='The character used to replace the invalid characters in the names of the filesystem items created by the fields.'
  • sanitize_fs_name Boolean
    default=True help="If checked, the names of the filesystem items created by the fields will be sanitized. Invalid characters will be replaced by the value provided by the field 'fs_name_sanitizatio_replace_char'."
  • use_as_default_for_fs_contents Boolean
    default=False help='If checked, this storage will be used to store the content of the external filesystem fields by default. '
Public methods (6)
  • get_default_storage_code_for_fs_content(self, model_name, field_name) -> str
    @api.model
    Return the code of the default storage for the content of the external filesystem fields.
  • get_storage_code_for_fs_content_fallback(self) -> <expr>
    @api.model@tools.ormcache()
  • is_fs_name_valid(self, name, raise_if_invalid=False) -> bool
  • is_fs_names_valid(self, names, raise_if_invalid=False) -> bool
  • sanitize_fs_item_name(self, name, replace_char=None) -> str
    Sanitize a filesystem item name by replacing invalid characters with a replacement character. :param name: the name to sanitize :param replace_char: the character to use as replacement. If not provided, the value of the field 'fs_name_sanitization_replace_char' will be used. :return: the sanitized name
  • sanitize_fs_item_names(self, names, replace_char=None) -> <expr>
    Sanitize a list of filesystem item names by replacing invalid characters with a replacement character. :param names: the names to sanitize :param replace_char: the character to use as replacement. If not provided, the value of the field 'fs_name_sanitization_replace_char' will be used. :return: the sanitized names

New fields (1)
  • ttype Selection
    ondelete={'fs_folder': 'cascade'} selection_add=[('fs_folder', 'External Folder')]
Public methods (0)

No public methods.

Loading…