Fs Folder

fs_folder
REPOSITORY
REPOSITORYOCA/storage
GIT
GIThttps://github.com/OCA/storage.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/storage/tree/19.0/fs_folder
VERSION
VERSION 2.0.0
CATEGORY
CATEGORYUncategorized
LICENSE
LICENSELGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), ACSONE SA/NV
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), ACSONE SA/NV
COMMITTERS
COMMITTERSStéphane Bidoul, Laurent Mignon (ACSONE)
WEBSITE
WEBSITEhttps://github.com/OCA/storage
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:40:49
ODOO DEPENDENCIES
ODOO DEPENDENCIES OCA/server-env:
    - server_environment
OCA/storage:
    - fs_storage
odoo/odoo:
    - base
    - base_sparse_field
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES fsspec>=2024.5.0
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
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 field Inherits fs_storage.fs_storage_form_view
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.

REPOSITORY
REPOSITORYOCA/storage
GIT
GIThttps://github.com/OCA/storage.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/storage/tree/18.0/fs_folder
VERSION
VERSION 2.0.0
CATEGORY
CATEGORYUncategorized
LICENSE
LICENSELGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), ACSONE SA/NV
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), ACSONE SA/NV
COMMITTERS
COMMITTERSStéphane Bidoul, Laurent Mignon (ACSONE), Enric Tobella, Weblate, OCA-git-bot, oca-ci, Julien Guenat
WEBSITE
WEBSITEhttps://github.com/OCA/storage
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:30:15
ODOO DEPENDENCIES
ODOO DEPENDENCIES OCA/server-env:
    - server_environment
OCA/storage:
    - fs_storage
odoo/odoo:
    - base
    - base_sparse_field
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES fsspec>=2024.5.0
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
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 field Inherits fs_storage.fs_storage_form_view
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.