Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.34
_commit: v1.35
_src_path: git+https://github.com/OCA/oca-addons-repo-template
additional_ruff_rules: []
ci: GitHub
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ exclude: |
^fs_folder_demo/|
^fs_folder_ms_drive/|
^fs_image/|
^fs_storage/|
^fs_storage_ms_drive/|
^image_tag/|
^microsoft_drive_account/|
Expand Down
32 changes: 0 additions & 32 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,12 @@ disable=all
# config as a blocking check.

enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
development-status-allowed,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
Expand All @@ -48,56 +39,33 @@ enable=anomalous-backslash-in-string,
method-inverse,
method-required-super,
method-search,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
attribute-string-redundant,
character-not-valid-in-resource-link,
consider-merging-classes-inherited,
context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
except-pass,
file-not-used,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
renamed-field-parameter,
resource-not-exist,
str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
external-request-timeout,
bad-builtin-groupby,
category-allowed,
Expand Down
32 changes: 0 additions & 32 deletions .pylintrc-mandatory
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,12 @@ valid-odoo-versions=19.0
disable=all

enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
development-status-allowed,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
Expand All @@ -40,56 +31,33 @@ enable=anomalous-backslash-in-string,
method-inverse,
method-required-super,
method-search,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
attribute-string-redundant,
character-not-valid-in-resource-link,
consider-merging-classes-inherited,
context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
except-pass,
file-not-used,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
renamed-field-parameter,
resource-not-exist,
str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
external-request-timeout,
bad-builtin-groupby,
category-allowed,
Expand Down
11 changes: 6 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/18.0/fs_storage
:target: https://github.com/OCA/storage/tree/19.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-18-0/storage-18-0-fs_storage
:target: https://translation.odoo-community.org/projects/storage-19-0/storage-19-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=18.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/storage&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -287,7 +287,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:%2018.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:%2019.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 All @@ -305,6 +305,7 @@ Contributors
- Laurent Mignon <laurent.mignon@acsone.eu>
- Sébastien BEAU <sebastien.beau@akretion.com>
- Marie Lejeune <marie.lejeune@acsone.eu>
- Julien Coux <julien.coux@camptocamp.com>

Maintainers
-----------
Expand All @@ -319,6 +320,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/18.0/fs_storage>`_ project on GitHub.
This module is part of the `OCA/storage <https://github.com/OCA/storage/tree/19.0/fs_storage>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 2 additions & 3 deletions fs_storage/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
{
"name": "Filesystem Storage Backend",
"summary": "Implement the concept of Storage with amazon S3, sftp...",
"version": "18.0.2.0.1",
"version": "19.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,
"depends": ["base", "base_sparse_field", "server_environment"],
"data": [
"views/fs_storage_view.xml",
"security/ir.model.access.csv",
"wizards/fs_test_connection.xml",
],
"demo": ["demo/fs_storage_demo.xml"],
"external_dependencies": {"python": ["fsspec>=2024.5.0"]},
"installable": True,
}
8 changes: 0 additions & 8 deletions fs_storage/demo/fs_storage_demo.xml

This file was deleted.

49 changes: 25 additions & 24 deletions fs_storage/models/fs_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import fsspec

from odoo import _, api, fields, models, tools
from odoo import api, fields, models, tools
from odoo.exceptions import ValidationError

from odoo.addons.base_sparse_field.models.fields import Serialized
Expand Down Expand Up @@ -189,13 +189,10 @@ def __init__(self, env, ids=(), prefetch_ids=()):
"* List File : List all files from root directory",
)

_sql_constraints = [
(
"code_uniq",
"unique(code)",
"The code must be unique",
),
]
_uniq_code = models.Constraint(
"unique(code)",
"The code must be unique",
)

_server_env_section_name_field = "code"

Expand All @@ -210,7 +207,7 @@ def _check_model_xmlid_storage_unique(self):
xmlids = rec.model_xmlids.split(",")
for xmlid in xmlids:
other_storages = (
self.env["fs.storage"]
self.env["fs.storage"] # pylint: disable=no-search-all
.search([])
.filtered_domain(
[
Expand All @@ -221,11 +218,12 @@ def _check_model_xmlid_storage_unique(self):
)
if other_storages:
raise ValidationError(
_(
self.env._(
"Model %(model)s already stored in another "
"FS storage ('%(other_storage)s')"
"FS storage ('%(other_storage)s')",
model=xmlid,
other_storage=other_storages[0].name,
)
% {"model": xmlid, "other_storage": other_storages[0].name}
)

@api.constrains("field_xmlids")
Expand All @@ -239,7 +237,7 @@ def _check_field_xmlid_storage_unique(self):
xmlids = rec.field_xmlids.split(",")
for xmlid in xmlids:
other_storages = (
self.env["fs.storage"]
self.env["fs.storage"] # pylint: disable=no-search-all
.search([])
.filtered_domain(
[
Expand All @@ -250,18 +248,19 @@ def _check_field_xmlid_storage_unique(self):
)
if other_storages:
raise ValidationError(
_(
self.env._(
"Field %(field)s already stored in another "
"FS storage ('%(other_storage)s')"
"FS storage ('%(other_storage)s')",
field=xmlid,
other_storage=other_storages[0].name,
)
% {"field": xmlid, "other_storage": other_storages[0].name}
)

@api.model
def _get_check_connection_method_selection(self):
return [
("marker_file", _("Create Marker file")),
("ls", _("List File")),
("marker_file", self.env._("Create Marker file")),
("ls", self.env._("List File")),
]

@property
Expand Down Expand Up @@ -338,7 +337,7 @@ def get_storage_code_by_model_field(self, model_name, field_name=None):
)
if field:
storage = (
self.env["fs.storage"]
self.env["fs.storage"] # pylint: disable=no-search-all
.sudo()
.search([])
.filtered_domain([("field_ids", "in", [field.id])])
Expand All @@ -353,7 +352,7 @@ def get_storage_code_by_model_field(self, model_name, field_name=None):
)
if model:
storage = (
self.env["fs.storage"]
self.env["fs.storage"] # pylint: disable=no-search-all
.sudo()
.search([])
.filtered_domain([("model_ids", "in", [model.id])])
Expand Down Expand Up @@ -399,7 +398,9 @@ def _check_options(self) -> None:
try:
json.loads(rec.options or "{}")
except Exception as e:
raise ValidationError(_("The options must be a valid JSON")) from e
raise ValidationError(
self.env._("The options must be a valid JSON")
) from e

@api.depends("options")
def _compute_json_options(self) -> None:
Expand Down Expand Up @@ -703,11 +704,11 @@ def action_test_config(self):
def _test_config(self, connection_method):
try:
self._check_connection(self.fs, connection_method)
title = _("Connection Test Succeeded!")
message = _("Everything seems properly set up!")
title = self.env._("Connection Test Succeeded!")
message = self.env._("Everything seems properly set up!")
msg_type = "success"
except Exception as err:
title = _("Connection Test Failed!")
title = self.env._("Connection Test Failed!")
message = str(err)
msg_type = "danger"
return {
Expand Down
1 change: 1 addition & 0 deletions fs_storage/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Laurent Mignon \<<laurent.mignon@acsone.eu>\>
- Sébastien BEAU \<<sebastien.beau@akretion.com>\>
- Marie Lejeune \<<marie.lejeune@acsone.eu>\>
- Julien Coux \<<julien.coux@camptocamp.com>\>
Loading