Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ exclude: |
^fs_folder_ms_drive/|
^fs_folder_webdav/|
^fs_image/|
^fs_storage/|
^fs_storage_environment/|
^fs_storage_ms_drive/|
^image_tag/|
Expand Down
10 changes: 5 additions & 5 deletions fs_storage/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Filesystem Storage Backend
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github
:target: https://github.com/OCA/storage/tree/19.0/fs_storage
:target: https://github.com/OCA/storage/tree/20.0/fs_storage
:alt: OCA/storage
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/storage-19-0/storage-19-0-fs_storage
:target: https://translation.odoo-community.org/projects/storage-20-0/storage-20-0-fs_storage
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/storage&target_branch=19.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/storage&target_branch=20.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -309,7 +309,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/storage/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/storage/issues/new?body=module:%20fs_storage%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/storage/issues/new?body=module:%20fs_storage%0Aversion:%2020.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -342,6 +342,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/storage <https://github.com/OCA/storage/tree/19.0/fs_storage>`_ project on GitHub.
This module is part of the `OCA/storage <https://github.com/OCA/storage/tree/20.0/fs_storage>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 3 additions & 3 deletions fs_storage/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
{
"name": "Filesystem Storage Backend",
"summary": "Implement the concept of Storage with amazon S3, sftp...",
"version": "19.0.1.1.3",
"version": "20.0.1.0.0",
"category": "FS Storage",
"website": "https://github.com/OCA/storage",
"author": " ACSONE SA/NV, Odoo Community Association (OCA)",
"license": "LGPL-3",
"development_status": "Beta",
"installable": False,
"installable": True,
"depends": ["base", "base_sparse_field"],
"data": [
"views/fs_storage_view.xml",
"security/ir.model.access.csv",
"security/ir.access.csv",
"wizards/fs_test_connection.xml",
],
"external_dependencies": {"python": ["fsspec>=2024.5.0"]},
Expand Down
26 changes: 12 additions & 14 deletions fs_storage/models/fs_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ def _get_check_connection_method_selection(self):
@prevent_call_from_safe_eval("create")
def create(self, vals_list):
records = super().create(vals_list)
self.env.registry.clear_cache()
return records

@prevent_call_from_safe_eval("create")
Expand All @@ -309,7 +308,6 @@ def _create(self, data_list):
@prevent_call_from_safe_eval("write")
def write(self, vals):
self.__fs = None
self.env.registry.clear_cache()
return super().write(vals)

@prevent_call_from_safe_eval("write")
Expand All @@ -330,7 +328,7 @@ def get_directory_path(self):
)

@api.model
@tools.ormcache()
@api.ormcache()
def get_id_by_code_map(self):
"""Return a dictionary with the code as key and the id as value."""
return {rec.code: rec.id for rec in self.sudo().search([])}
Expand All @@ -350,13 +348,13 @@ def get_by_code(self, code) -> FSStorage:
return res

@api.model
@tools.ormcache("code")
@api.ormcache("code")
def get_protocol_by_code(self, code):
record = self.get_by_code(code)
return record.protocol if record else None

@api.model
@tools.ormcache("code")
@api.ormcache("code")
def _is_fs_cacheable(self, code):
"""Return True if the filesystem is cacheable."""
# This method is used to check if the filesystem is cacheable.
Expand All @@ -367,13 +365,13 @@ def _is_fs_cacheable(self, code):
return fs_storage and fs_storage.sudo().is_cacheable

@api.model
@tools.ormcache()
@api.ormcache()
def get_storage_codes(self):
"""Return the list of codes of the existing filesystems."""
return [s.code for s in self.search([])]

@api.model
@tools.ormcache("code")
@api.ormcache("code")
def _get_fs_by_code_from_cache(self, code):
return self.get_fs_by_code(code, force_no_cache=True)

Expand All @@ -395,7 +393,7 @@ def get_fs_by_code(self, code, force_no_cache=False):
return fs

@api.model
@tools.ormcache("model_name", "field_name")
@api.ormcache("model_name", "field_name")
def get_storage_code_by_model_field(self, model_name, field_name=None):
"""Return the storage backend associated to the given model and field.

Expand Down Expand Up @@ -463,7 +461,7 @@ def _get_protocols(self) -> list[tuple[str, str]]:
try:
cls = fsspec.get_filesystem_class(p)
protocol.append((p, f"{p} ({cls.__name__})"))
except Exception as e:
except (ValueError, ImportError) as e:
_logger.debug("Cannot load the protocol %s. Reason: %s", p, e)
return protocol

Expand All @@ -472,7 +470,7 @@ def _check_options(self) -> None:
for rec in self:
try:
json.loads(rec.options or "{}")
except Exception as e:
except json.JSONDecodeError as e:
raise ValidationError(
self.env._("The options must be a valid JSON")
) from e
Expand All @@ -499,7 +497,7 @@ def _get_options_protocol(self) -> list[tuple[str, str]]:
try:
fsspec.get_filesystem_class(p)
protocol.append((p, p))
except Exception as e:
except (ValueError, ImportError) as e:
_logger.debug("Cannot load the protocol %s. Reason: %s", p, e)
return protocol

Expand Down Expand Up @@ -601,10 +599,10 @@ def fs(self) -> fsspec.AbstractFileSystem:
# Use a marker file to limit the scope of the LS command for performance.
try:
self._check_connection(self.__fs, self.check_connection_method)
except Exception as e:
except Exception:
self.__fs.clear_instance_cache()
self.__fs = None
raise e
raise
return self.__fs

def _get_filesystem_storage_path(self) -> str:
Expand Down Expand Up @@ -782,7 +780,7 @@ def _test_config(self, connection_method):
title = self.env._("Connection Test Succeeded!")
message = self.env._("Everything seems properly set up!")
msg_type = "success"
except Exception as err:
except Exception as err: # noqa: BLE001
title = self.env._("Connection Test Failed!")
message = str(err)
msg_type = "danger"
Expand Down
3 changes: 3 additions & 0 deletions fs_storage/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions fs_storage/security/ir.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id,group_id/id,operation,domain
access_fs_storage_edit,fs_storage edit,fs.storage,base.group_system,crud
access_fs_test_connection,fs.test.connection.access,fs.test.connection,base.group_system,crud
3 changes: 0 additions & 3 deletions fs_storage/security/ir.model.access.csv

This file was deleted.

6 changes: 3 additions & 3 deletions fs_storage/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ <h1>Filesystem Storage Backend</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:81951fe8521a3c09940411a4e9fa4b79f4571cb3cb9209762018c099656b472a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/storage/tree/19.0/fs_storage"><img alt="OCA/storage" src="https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/storage-19-0/storage-19-0-fs_storage"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/storage&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/storage/tree/20.0/fs_storage"><img alt="OCA/storage" src="https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/storage-20-0/storage-20-0-fs_storage"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/storage&amp;target_branch=20.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
Expand Down Expand Up @@ -675,7 +675,7 @@ <h2><a class="toc-backref" href="#toc-entry-18">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/storage/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/storage/issues/new?body=module:%20fs_storage%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/storage/issues/new?body=module:%20fs_storage%0Aversion:%2020.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -704,7 +704,7 @@ <h3><a class="toc-backref" href="#toc-entry-22">Maintainers</a></h3>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/storage/tree/19.0/fs_storage">OCA/storage</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/storage/tree/20.0/fs_storage">OCA/storage</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
16 changes: 0 additions & 16 deletions fs_storage/upgrades/18.0.2.1.0/post-update.py

This file was deleted.

6 changes: 3 additions & 3 deletions fs_storage/views/fs_storage_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</search>
</field>
</record>
<record model="ir.actions.act_window" id="act_open_fs_storage_view">
<record id="act_open_fs_storage_view" model="ir.actions.act_window">
<field name="name">FS Storage</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">fs.storage</field>
Expand All @@ -105,13 +105,13 @@
<field name="domain">[]</field>
<field name="context">{}</field>
</record>
<record model="ir.actions.act_window.view" id="act_open_fs_storage_view_form">
<record id="act_open_fs_storage_view_form" model="ir.actions.act_window.view">
<field name="act_window_id" ref="act_open_fs_storage_view" />
<field name="sequence" eval="20" />
<field name="view_mode">form</field>
<field name="view_id" ref="fs_storage_form_view" />
</record>
<record model="ir.actions.act_window.view" id="act_open_fs_storage_view_tree">
<record id="act_open_fs_storage_view_tree" model="ir.actions.act_window.view">
<field name="act_window_id" ref="act_open_fs_storage_view" />
<field name="sequence" eval="10" />
<field name="view_mode">list</field>
Expand Down
2 changes: 1 addition & 1 deletion fs_storage/wizards/fs_test_connection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="act_open_fs_test_connection_view">
<record id="act_open_fs_test_connection_view" model="ir.actions.act_window">
<field name="name">FS Test Connection</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">fs.test.connection</field>
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# generated from manifests external_dependencies
fsspec>=2024.5.0
Loading