TIP: You can type at any time to perform a new search.
Filesystem Storage Backend
fs_storage · OCA/storage
- Repository
- OCA/storage · module folder · Try on Runboat
- Module version
- 1.1.2
- Category
- FS Storage
- Folder size
- 0.24 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), David Beal, Iván Todorovich, Weblate, OCA-git-bot, oca-ci
- Odoo dependencies
- Python dependencies
- fsspec>=2024.5.0
- System dependencies
- None
- Required by
- fs_attachment, fs_folder, fs_storage_ms_drive
- Description
This addon is a technical addon that allows you to define filesystem like storage for your data. It's used by other addons to store their data in a transparent way into different kind of storages. Through the fs.storage record, you get access to an object that implements the [fsspec.spec.AbstractFileSystem](https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.spec.AbstractFileSystem) interface and therefore give you an unified interface to access your data whatever the storage protocol you decide to use. The list of supported protocols depends on the installed fsspec implementations. By default, the addon will install the following protocols: - LocalFileSystem - MemoryFileSystem - ZipFileSystem - TarFileSystem - FTPFileSystem - CachingFileSystem - WholeFileSystem - SimplCacheFileSystem - ReferenceFileSystem - GenericFileSystem - DirFileSystem - DatabricksFileSystem - GitHubFileSystem - JupiterFileSystem - OdooFileSystem The OdooFileSystem is the one that allows you to store your data into a directory mounted into your Odoo's storage directory. This is the default FS Storage when creating a new fs.storage record. Others protocols are available through the installation of additional python packages: - DropboxDriveFileSystem -\> pip install fsspec\[dropbox\] - HTTPFileSystem -\> pip install fsspec\[http\] - HTTPSFileSystem -\> pip install fsspec\[http\] - GCSFileSystem -\> pip install fsspec\[gcs\] - GSFileSystem -\> pip install fsspec\[gs\] - GoogleDriveFileSystem -\> pip install gdrivefs - SFTPFileSystem -\> pip install fsspec\[sftp\] - HaddoopFileSystem -\> pip install fsspec\[hdfs\] - S3FileSystem -\> pip install fsspec\[s3\] - WandbFS -\> pip install wandbfs - OCIFileSystem -\> pip install fsspec\[oci\] - AsyncLocalFileSystem -\> pip install 'morefs\[asynclocalfs\] - AzureDatalakeFileSystem -\> pip install fsspec\[adl\] - AzureBlobFileSystem -\> pip install fsspec\[abfs\] - DaskWorkerFileSystem -\> pip install fsspec\[dask\] - GitFileSystem -\> pip install fsspec\[git\] - SMBFileSystem -\> pip install fsspec\[smb\] - LibArchiveFileSystem -\> pip install fsspec\[libarchive\] - OSSFileSystem -\> pip install ossfs - WebdavFileSystem -\> pip install webdav4 - DVCFileSystem -\> pip install dvc - XRootDFileSystem -\> pip install fsspec-xrootd This list of supported protocols is not exhaustive or could change in the future depending on the fsspec releases. You can find more information about the supported protocols on the [fsspec documentation](https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.spec.AbstractFileSystem).
Code Analysis ⓘ
Views touched (4)
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
fs_storage_form_view |
fs.storage.form (in fs_storage) | fs.storage | form | New |
fs_storage_search_view |
fs.storage.search (in fs_storage) | fs.storage | search | New |
fs_storage_tree_view |
fs.storage.list (in fs_storage) | fs.storage | list | New |
fs_test_connection_form_view |
fs.test.connection.form | fs.test.connection | form | New |
HTTP endpoints (0)
No HTTP endpoints found for this module.
Models touched (4)
New fields (15)
-
check_connection_methodSelectiondefault='marker_file'help='Set a method if you want the connection to remote to be checked every time the storage is used, in order to remove the obsolete connection from the cache.\n* Create Marker file : Create a file on remote and check it exists\n* List File : List all files from root directory'selection='_get_check_connection_method_selection' -
codeCharhelp="Technical code used to identify the storage backend into the code.This code must be unique. This code is used for example to define the storage backend to store the attachments via the configuration parameter 'ir_attachment.storage.force.database' when the module 'fs_attachment' is installed."required=True -
directory_pathCharhelp='Relative path to the directory to store the file' -
eval_options_from_envBooleanhelp='Resolve options values starting with $ from environment variables. e.g\n {\n "endpoint_url": "$AWS_ENDPOINT_URL",\n }\n 'string='Resolve env vars' -
field_idsOne2many → ir.model.fieldscompute='_compute_field_ids'help='List of fields such as attachments linked to one of these fields will be stored in this storage. NB: If the attachment is linked to a field that is in one FS storage, and the related model is in another FS storage, we will store it into the storage linked to the resource field.'inverse='_inverse_field_ids' args: 'ir.model.fields', 'storage_id' -
field_xmlidsCharhelp='List of fields xml ids such as attachments linked to one of these fields will be stored in this storage. NB: If the attachment is linked to a field that is in one FS storage, and the related model is in another FS storage, we will store it into the storage linked to the resource field.' -
is_cacheableBooleandefault=Truehelp='If True, once instantiated, the filesystem will be cached and reused.\nBy default, the filesystem is cacheable but in some cases, like when using OAuth2 authentication, the filesystem cannot be cached because it depends on the user and the token can change.\nIn this case, you can set this field to False to avoid caching the filesystem.' -
model_idsOne2many → ir.modelcompute='_compute_model_ids'help='List of models such as attachments linked to one of these models will be stored in this storage.'inverse='_inverse_model_ids' args: 'ir.model', 'storage_id' -
model_xmlidsCharhelp='List of models xml ids such as attachments linked to one of these models will be stored in this storage.' -
nameCharrequired=True -
optionsTexthelp="The options used to initialize the filesystem.\nThis is a JSON field that depends on the protocol used.\nFor example, for the sftp protocol, you can provide the following:\n{\n 'host': 'my.sftp.server',\n 'username': 'myuser',\n 'password': 'mypassword',\n 'port': 22\n}\nFor more information, please refer to the fsspec documentation:\nhttps://filesystem-spec.readthedocs.io/en/latest/api.html#built-in-implementations" -
options_propertiesTextcompute='_compute_options_properties'store=Falsestring='Available properties' -
options_protocolSelectioncompute='_compute_protocol_descr'help='The protocol used to access the content of filesystem.\nThis list is the one supported by the fsspec library (see https://filesystem-spec.readthedocs.io/en/latest). A filesystem protocolis added by default and refers to the odoo local filesystem.\nPay attention that according to the protocol, some options must beprovided through the options field.'selection='_get_options_protocol'string='Describes Protocol' -
protocolSelectionhelp='The protocol used to access the content of filesystem.\nThis list is the one supported by the fsspec library (see https://filesystem-spec.readthedocs.io/en/latest). A filesystem protocolis added by default and refers to the odoo local filesystem.\nPay attention that according to the protocol, some options must beprovided through the options field.'required=Trueselection='_get_protocols' -
protocol_descrTextcompute='_compute_protocol_descr'
-
action_test_config(self) -
add(self, relative_path, data, binary=True, **kwargs) -> None@deprecated('Please use _get_filesystem() instead and the fsspec API directly.') -
copy(self, default=None) -
create(self, vals_list)@api.model_create_multi@prevent_call_from_safe_eval('create') -
delete(self, relative_path) -> None@deprecated('Please use _get_filesystem() instead and the fsspec API directly.') -
find_files(self, pattern, relative_path='', **kw) -> <expr>@deprecated('Please use _get_filesystem() instead and the fsspec API directly.')Find files matching given pattern. :param pattern: regex expression :param relative_path: optional relative path containing files :return: list of file paths as full paths from the root -
fs(self) -> fsspec.AbstractFileSystem@propertyGet the fsspec filesystem for this backend. -
get(self, relative_path, binary=True, **kwargs) -> AnyStr@deprecated('Please use _get_filesystem() instead and the fsspec API directly.') -
get_by_code(self, code) -> FSStorage@api.modelReturn the filesystem associated to the given code. -
get_directory_path(self)Returns directory path with substitution done. -
get_fs_by_code(self, code, force_no_cache=False)@api.modelReturn the filesystem associated to the given code. :param code: the code of the filesystem -
get_id_by_code(self, code)@api.modelReturn the id of the filesystem associated to the given code. -
get_id_by_code_map(self)@api.model@tools.ormcache()Return a dictionary with the code as key and the id as value. -
get_protocol_by_code(self, code)@api.model@tools.ormcache('code') -
get_storage_code_by_model_field(self, model_name, field_name=None)@api.model@tools.ormcache('model_name', 'field_name')Return the storage backend associated to the given model and field. :param model_name: the name of the model :param field_name (optionnal): the name of the field -
get_storage_codes(self)@api.model@tools.ormcache()Return the list of codes of the existing filesystems. -
list_files(self, relative_path='', pattern=False) -> <expr>@deprecated('Please use _get_filesystem() instead and the fsspec API directly.') -
move_files(self, files, destination_path, **kw) -> None@deprecated('Please use _get_filesystem() instead and the fsspec API directly.')Move files to given destination. :param files: list of file paths to be moved :param destination_path: directory path where to move files :return: None -
write(self, vals)@prevent_call_from_safe_eval('write')
New fields (2)
-
check_connection_methodSelectionrequired=Trueselection='_get_check_connection_method_selection' -
storage_idMany2one → fs.storageargs: 'fs.storage'
-
action_test_config(self) -
default_get(self, field_list)@api.model
New fields (1)
-
storage_idMany2one → fs.storagehelp='If specified, all attachments linked to this model will be stored in the provided storage.' args: 'fs.storage'
No public methods.
New fields (1)
-
storage_idMany2one → fs.storagehelp='If specified, all attachments linked to this field will be stored in the provided storage.' args: 'fs.storage'
No public methods.
Loading…
Loading…
Loading…