Skip to content

Commit 0eb8c38

Browse files
committed
[REF] fs_storage: server_environment should not be a required dependency
1 parent a7c377d commit 0eb8c38

7 files changed

Lines changed: 66 additions & 146 deletions

File tree

fs_attachment/tests/test_fs_storage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ def test_url_for_image_dir_optimized_and_not_obfuscated(self):
299299
{
300300
"name": "FS Product Image Backend",
301301
"code": "file",
302+
"protocol": "odoofs",
302303
"base_url": "https://localhost/images",
303304
"optimizes_directory_path": True,
304305
"use_filename_obfuscation": False,

fs_storage/README.rst

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ When you create a new backend, you must specify the following:
129129
depend on the protocol used and are described in the fsspec
130130
documentation.
131131

132-
- Resolve env vars. This options resolves the protocol options values
133-
starting with $ from environment variables
134-
135132
- Check Connection Method. If set, Odoo will always check the connection
136133
before using a storage and it will remove the fs connection from the
137134
cache if the check fails.
@@ -166,35 +163,6 @@ follows:
166163
In this example, the SimpleCacheFileSystem protocol will be used as a
167164
wrapper around the odoofs protocol.
168165

169-
Server Environment
170-
------------------
171-
172-
To ease the management of the filesystem storages configuration accross
173-
the different environments, the configuration of the filesystem storages
174-
can be defined in environment files or directly in the main
175-
configuration file. For example, the configuration of a filesystem
176-
storage with the code fsprod can be provided in the main configuration
177-
file as follows:
178-
179-
.. code:: ini
180-
181-
[fs_storage.fsprod]
182-
protocol=s3
183-
options={"endpoint_url": "https://my_s3_server/", "key": "KEY", "secret": "SECRET"}
184-
directory_path=my_bucket
185-
186-
To work, a storage.backend record must exist with the code fsprod into
187-
the database. In your configuration section, you can specify the value
188-
for the following fields:
189-
190-
- protocol
191-
- options
192-
- directory_path
193-
194-
When evaluating directory_path, ``{db_name}`` is replaced by the
195-
database name. This is usefull in multi-tenant with a setup completly
196-
controlled by configuration files.
197-
198166
Migration from storage_backend
199167
------------------------------
200168

fs_storage/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
{
66
"name": "Filesystem Storage Backend",
77
"summary": "Implement the concept of Storage with amazon S3, sftp...",
8-
"version": "19.0.1.1.1",
8+
"version": "19.0.1.1.2",
99
"category": "FS Storage",
1010
"website": "https://github.com/OCA/storage",
1111
"author": " ACSONE SA/NV, Odoo Community Association (OCA)",
1212
"license": "LGPL-3",
1313
"development_status": "Beta",
14-
"depends": ["base", "base_sparse_field", "server_environment"],
14+
"depends": ["base", "base_sparse_field"],
1515
"data": [
1616
"views/fs_storage_view.xml",
1717
"security/ir.model.access.csv",

fs_storage/models/fs_storage.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def wrapper(self, *args, **kwargs):
8989

9090
class FSStorage(models.Model):
9191
_name = "fs.storage"
92-
_inherit = "server.env.mixin"
9392
_description = "FS Storage"
9493

9594
__slots__ = ("__fs", "__odoo_storage_path")
@@ -231,8 +230,6 @@ def __init__(self, env, ids=(), prefetch_ids=()):
231230
"The code must be unique",
232231
)
233232

234-
_server_env_section_name_field = "code"
235-
236233
@api.constrains("model_xmlids")
237234
def _check_model_xmlid_storage_unique(self):
238235
"""
@@ -300,18 +297,6 @@ def _get_check_connection_method_selection(self):
300297
("ls", self.env._("List File")),
301298
]
302299

303-
@property
304-
def _server_env_fields(self):
305-
return {
306-
"protocol": {},
307-
"options": {},
308-
"directory_path": {},
309-
"eval_options_from_env": {},
310-
"model_xmlids": {},
311-
"field_xmlids": {},
312-
"check_connection_method": {},
313-
}
314-
315300
@api.model_create_multi
316301
@prevent_call_from_safe_eval("create")
317302
def create(self, vals_list):

fs_storage/readme/USAGE.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ When you create a new backend, you must specify the following:
1616
fsspec python package when creating the filesystem. These options
1717
depend on the protocol used and are described in the fsspec
1818
documentation.
19-
- Resolve env vars. This options resolves the protocol options values
20-
starting with \$ from environment variables
2119
- Check Connection Method. If set, Odoo will always check the connection before
2220
using a storage and it will remove the fs connection from the cache if the
2321
check fails.
@@ -51,34 +49,6 @@ follows:
5149
In this example, the SimpleCacheFileSystem protocol will be used as a
5250
wrapper around the odoofs protocol.
5351

54-
## Server Environment
55-
56-
To ease the management of the filesystem storages configuration accross
57-
the different environments, the configuration of the filesystem storages
58-
can be defined in environment files or directly in the main
59-
configuration file. For example, the configuration of a filesystem
60-
storage with the code fsprod can be provided in the main configuration
61-
file as follows:
62-
63-
``` ini
64-
[fs_storage.fsprod]
65-
protocol=s3
66-
options={"endpoint_url": "https://my_s3_server/", "key": "KEY", "secret": "SECRET"}
67-
directory_path=my_bucket
68-
```
69-
70-
To work, a storage.backend record must exist with the code fsprod into
71-
the database. In your configuration section, you can specify the value
72-
for the following fields:
73-
74-
- protocol
75-
- options
76-
- directory_path
77-
78-
When evaluating directory_path, `{db_name}` is replaced by the database name.
79-
This is usefull in multi-tenant with a setup completly controlled by
80-
configuration files.
81-
8252
## Migration from storage_backend
8353

8454
The fs_storage addon can be used to replace the storage_backend addon.

fs_storage/static/description/index.html

Lines changed: 38 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -441,38 +441,37 @@ <h1>Filesystem Storage Backend</h1>
441441
<ul class="simple">
442442
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a><ul>
443443
<li><a class="reference internal" href="#configuration" id="toc-entry-2">Configuration</a></li>
444-
<li><a class="reference internal" href="#server-environment" id="toc-entry-3">Server Environment</a></li>
445-
<li><a class="reference internal" href="#migration-from-storage-backend" id="toc-entry-4">Migration from storage_backend</a></li>
444+
<li><a class="reference internal" href="#migration-from-storage-backend" id="toc-entry-3">Migration from storage_backend</a></li>
446445
</ul>
447446
</li>
448-
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-5">Known issues / Roadmap</a></li>
449-
<li><a class="reference internal" href="#changelog" id="toc-entry-6">Changelog</a><ul>
450-
<li><a class="reference internal" href="#section-1" id="toc-entry-7">19.0.1.1.0 (2026-03-18)</a><ul>
451-
<li><a class="reference internal" href="#features" id="toc-entry-8">Features</a></li>
447+
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-4">Known issues / Roadmap</a></li>
448+
<li><a class="reference internal" href="#changelog" id="toc-entry-5">Changelog</a><ul>
449+
<li><a class="reference internal" href="#section-1" id="toc-entry-6">19.0.1.1.0 (2026-03-18)</a><ul>
450+
<li><a class="reference internal" href="#features" id="toc-entry-7">Features</a></li>
452451
</ul>
453452
</li>
454-
<li><a class="reference internal" href="#section-2" id="toc-entry-9">18.0.2.1.0 (2025-10-20)</a><ul>
455-
<li><a class="reference internal" href="#features-1" id="toc-entry-10">Features</a></li>
453+
<li><a class="reference internal" href="#section-2" id="toc-entry-8">18.0.2.1.0 (2025-10-20)</a><ul>
454+
<li><a class="reference internal" href="#features-1" id="toc-entry-9">Features</a></li>
456455
</ul>
457456
</li>
458-
<li><a class="reference internal" href="#section-3" id="toc-entry-11">18.0.2.0.1 (2025-07-23)</a><ul>
459-
<li><a class="reference internal" href="#features-2" id="toc-entry-12">Features</a></li>
457+
<li><a class="reference internal" href="#section-3" id="toc-entry-10">18.0.2.0.1 (2025-07-23)</a><ul>
458+
<li><a class="reference internal" href="#features-2" id="toc-entry-11">Features</a></li>
460459
</ul>
461460
</li>
462-
<li><a class="reference internal" href="#section-4" id="toc-entry-13">18.0.1.0.1 (2024-11-10)</a><ul>
463-
<li><a class="reference internal" href="#features-3" id="toc-entry-14">Features</a></li>
461+
<li><a class="reference internal" href="#section-4" id="toc-entry-12">18.0.1.0.1 (2024-11-10)</a><ul>
462+
<li><a class="reference internal" href="#features-3" id="toc-entry-13">Features</a></li>
464463
</ul>
465464
</li>
466-
<li><a class="reference internal" href="#section-5" id="toc-entry-15">16.0.1.1.0 (2023-12-22)</a></li>
467-
<li><a class="reference internal" href="#section-6" id="toc-entry-16">16.0.1.0.3 (2023-10-17)</a></li>
468-
<li><a class="reference internal" href="#section-7" id="toc-entry-17">16.0.1.0.2 (2023-10-09)</a></li>
465+
<li><a class="reference internal" href="#section-5" id="toc-entry-14">16.0.1.1.0 (2023-12-22)</a></li>
466+
<li><a class="reference internal" href="#section-6" id="toc-entry-15">16.0.1.0.3 (2023-10-17)</a></li>
467+
<li><a class="reference internal" href="#section-7" id="toc-entry-16">16.0.1.0.2 (2023-10-09)</a></li>
469468
</ul>
470469
</li>
471-
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-18">Bug Tracker</a></li>
472-
<li><a class="reference internal" href="#credits" id="toc-entry-19">Credits</a><ul>
473-
<li><a class="reference internal" href="#authors" id="toc-entry-20">Authors</a></li>
474-
<li><a class="reference internal" href="#contributors" id="toc-entry-21">Contributors</a></li>
475-
<li><a class="reference internal" href="#maintainers" id="toc-entry-22">Maintainers</a></li>
470+
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-17">Bug Tracker</a></li>
471+
<li><a class="reference internal" href="#credits" id="toc-entry-18">Credits</a><ul>
472+
<li><a class="reference internal" href="#authors" id="toc-entry-19">Authors</a></li>
473+
<li><a class="reference internal" href="#contributors" id="toc-entry-20">Contributors</a></li>
474+
<li><a class="reference internal" href="#maintainers" id="toc-entry-21">Maintainers</a></li>
476475
</ul>
477476
</li>
478477
</ul>
@@ -497,8 +496,6 @@ <h3><a class="toc-backref" href="#toc-entry-2">Configuration</a></h3>
497496
fsspec python package when creating the filesystem. These options
498497
depend on the protocol used and are described in the fsspec
499498
documentation.</li>
500-
<li>Resolve env vars. This options resolves the protocol options values
501-
starting with $ from environment variables</li>
502499
<li>Check Connection Method. If set, Odoo will always check the connection
503500
before using a storage and it will remove the fs connection from the
504501
cache if the check fails.<ul>
@@ -531,34 +528,8 @@ <h3><a class="toc-backref" href="#toc-entry-2">Configuration</a></h3>
531528
<p>In this example, the SimpleCacheFileSystem protocol will be used as a
532529
wrapper around the odoofs protocol.</p>
533530
</div>
534-
<div class="section" id="server-environment">
535-
<h3><a class="toc-backref" href="#toc-entry-3">Server Environment</a></h3>
536-
<p>To ease the management of the filesystem storages configuration accross
537-
the different environments, the configuration of the filesystem storages
538-
can be defined in environment files or directly in the main
539-
configuration file. For example, the configuration of a filesystem
540-
storage with the code fsprod can be provided in the main configuration
541-
file as follows:</p>
542-
<pre class="code ini literal-block">
543-
<span class="k">[fs_storage.fsprod]</span><span class="w">
544-
</span><span class="na">protocol</span><span class="o">=</span><span class="s">s3</span><span class="w">
545-
</span><span class="na">options={&quot;endpoint_url&quot;</span><span class="o">:</span><span class="w"> </span><span class="s">&quot;https://my_s3_server/&quot;</span><span class="na">, &quot;key&quot;</span><span class="o">:</span><span class="w"> </span><span class="s">&quot;KEY&quot;</span><span class="na">, &quot;secret&quot;</span><span class="o">:</span><span class="w"> </span><span class="s">&quot;SECRET&quot;</span><span class="na">}</span><span class="w">
546-
</span><span class="na">directory_path</span><span class="o">=</span><span class="s">my_bucket</span>
547-
</pre>
548-
<p>To work, a storage.backend record must exist with the code fsprod into
549-
the database. In your configuration section, you can specify the value
550-
for the following fields:</p>
551-
<ul class="simple">
552-
<li>protocol</li>
553-
<li>options</li>
554-
<li>directory_path</li>
555-
</ul>
556-
<p>When evaluating directory_path, <tt class="docutils literal">{db_name}</tt> is replaced by the
557-
database name. This is usefull in multi-tenant with a setup completly
558-
controlled by configuration files.</p>
559-
</div>
560531
<div class="section" id="migration-from-storage-backend">
561-
<h3><a class="toc-backref" href="#toc-entry-4">Migration from storage_backend</a></h3>
532+
<h3><a class="toc-backref" href="#toc-entry-3">Migration from storage_backend</a></h3>
562533
<p>The fs_storage addon can be used to replace the storage_backend addon.
563534
(It has been designed to be a drop-in replacement for the
564535
storage_backend addon). To ease the migration, the fs.storage model
@@ -583,7 +554,7 @@ <h3><a class="toc-backref" href="#toc-entry-4">Migration from storage_backend</a
583554
</div>
584555
</div>
585556
<div class="section" id="known-issues-roadmap">
586-
<h2><a class="toc-backref" href="#toc-entry-5">Known issues / Roadmap</a></h2>
557+
<h2><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h2>
587558
<ul class="simple">
588559
<li>Transactions: fsspec comes with a transactional mechanism that once
589560
started, gathers all the files created during the transaction, and if
@@ -598,40 +569,40 @@ <h2><a class="toc-backref" href="#toc-entry-5">Known issues / Roadmap</a></h2>
598569
</ul>
599570
</div>
600571
<div class="section" id="changelog">
601-
<h2><a class="toc-backref" href="#toc-entry-6">Changelog</a></h2>
572+
<h2><a class="toc-backref" href="#toc-entry-5">Changelog</a></h2>
602573
<div class="section" id="section-1">
603-
<h3><a class="toc-backref" href="#toc-entry-7">19.0.1.1.0 (2026-03-18)</a></h3>
574+
<h3><a class="toc-backref" href="#toc-entry-6">19.0.1.1.0 (2026-03-18)</a></h3>
604575
<div class="section" id="features">
605-
<h4><a class="toc-backref" href="#toc-entry-8">Features</a></h4>
576+
<h4><a class="toc-backref" href="#toc-entry-7">Features</a></h4>
606577
<ul class="simple">
607578
<li>Replace {db_name} by the database name in directory_path
608579
(<a class="reference external" href="https://github.com/OCA/storage/issues/db_name">#db_name</a>)</li>
609580
</ul>
610581
</div>
611582
</div>
612583
<div class="section" id="section-2">
613-
<h3><a class="toc-backref" href="#toc-entry-9">18.0.2.1.0 (2025-10-20)</a></h3>
584+
<h3><a class="toc-backref" href="#toc-entry-8">18.0.2.1.0 (2025-10-20)</a></h3>
614585
<div class="section" id="features-1">
615-
<h4><a class="toc-backref" href="#toc-entry-10">Features</a></h4>
586+
<h4><a class="toc-backref" href="#toc-entry-9">Features</a></h4>
616587
<ul class="simple">
617588
<li>Replace {db_name} by the database name in directory_path
618589
(<a class="reference external" href="https://github.com/OCA/storage/issues/db_name">#db_name</a>)</li>
619590
</ul>
620591
</div>
621592
</div>
622593
<div class="section" id="section-3">
623-
<h3><a class="toc-backref" href="#toc-entry-11">18.0.2.0.1 (2025-07-23)</a></h3>
594+
<h3><a class="toc-backref" href="#toc-entry-10">18.0.2.0.1 (2025-07-23)</a></h3>
624595
<div class="section" id="features-2">
625-
<h4><a class="toc-backref" href="#toc-entry-12">Features</a></h4>
596+
<h4><a class="toc-backref" href="#toc-entry-11">Features</a></h4>
626597
<ul class="simple">
627598
<li>Allow setting check_connection_method in configuration file.</li>
628599
</ul>
629600
</div>
630601
</div>
631602
<div class="section" id="section-4">
632-
<h3><a class="toc-backref" href="#toc-entry-13">18.0.1.0.1 (2024-11-10)</a></h3>
603+
<h3><a class="toc-backref" href="#toc-entry-12">18.0.1.0.1 (2024-11-10)</a></h3>
633604
<div class="section" id="features-3">
634-
<h4><a class="toc-backref" href="#toc-entry-14">Features</a></h4>
605+
<h4><a class="toc-backref" href="#toc-entry-13">Features</a></h4>
635606
<ul class="simple">
636607
<li>Invalidate FS filesystem object cache when the connection fails,
637608
forcing a reconnection.
@@ -640,7 +611,7 @@ <h4><a class="toc-backref" href="#toc-entry-14">Features</a></h4>
640611
</div>
641612
</div>
642613
<div class="section" id="section-5">
643-
<h3><a class="toc-backref" href="#toc-entry-15">16.0.1.1.0 (2023-12-22)</a></h3>
614+
<h3><a class="toc-backref" href="#toc-entry-14">16.0.1.1.0 (2023-12-22)</a></h3>
644615
<p><strong>Features</strong></p>
645616
<ul class="simple">
646617
<li>Add parameter on storage backend to resolve protocol options values
@@ -649,7 +620,7 @@ <h3><a class="toc-backref" href="#toc-entry-15">16.0.1.1.0 (2023-12-22)</a></h3>
649620
</ul>
650621
</div>
651622
<div class="section" id="section-6">
652-
<h3><a class="toc-backref" href="#toc-entry-16">16.0.1.0.3 (2023-10-17)</a></h3>
623+
<h3><a class="toc-backref" href="#toc-entry-15">16.0.1.0.3 (2023-10-17)</a></h3>
653624
<p><strong>Bugfixes</strong></p>
654625
<ul class="simple">
655626
<li>Fix access to technical models to be able to upload attachments for
@@ -658,7 +629,7 @@ <h3><a class="toc-backref" href="#toc-entry-16">16.0.1.0.3 (2023-10-17)</a></h3>
658629
</ul>
659630
</div>
660631
<div class="section" id="section-7">
661-
<h3><a class="toc-backref" href="#toc-entry-17">16.0.1.0.2 (2023-10-09)</a></h3>
632+
<h3><a class="toc-backref" href="#toc-entry-16">16.0.1.0.2 (2023-10-09)</a></h3>
662633
<p><strong>Bugfixes</strong></p>
663634
<ul class="simple">
664635
<li>Avoid config error when using the webdav protocol. The auth option is
@@ -671,23 +642,23 @@ <h3><a class="toc-backref" href="#toc-entry-17">16.0.1.0.2 (2023-10-09)</a></h3>
671642
</div>
672643
</div>
673644
<div class="section" id="bug-tracker">
674-
<h2><a class="toc-backref" href="#toc-entry-18">Bug Tracker</a></h2>
645+
<h2><a class="toc-backref" href="#toc-entry-17">Bug Tracker</a></h2>
675646
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/storage/issues">GitHub Issues</a>.
676647
In case of trouble, please check there if your issue has already been reported.
677648
If you spotted it first, help us to smash it by providing a detailed and welcomed
678649
<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>
679650
<p>Do not contact contributors directly about support or help with technical issues.</p>
680651
</div>
681652
<div class="section" id="credits">
682-
<h2><a class="toc-backref" href="#toc-entry-19">Credits</a></h2>
653+
<h2><a class="toc-backref" href="#toc-entry-18">Credits</a></h2>
683654
<div class="section" id="authors">
684-
<h3><a class="toc-backref" href="#toc-entry-20">Authors</a></h3>
655+
<h3><a class="toc-backref" href="#toc-entry-19">Authors</a></h3>
685656
<ul class="simple">
686657
<li>ACSONE SA/NV</li>
687658
</ul>
688659
</div>
689660
<div class="section" id="contributors">
690-
<h3><a class="toc-backref" href="#toc-entry-21">Contributors</a></h3>
661+
<h3><a class="toc-backref" href="#toc-entry-20">Contributors</a></h3>
691662
<ul class="simple">
692663
<li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li>
693664
<li>Sébastien BEAU &lt;<a class="reference external" href="mailto:sebastien.beau&#64;akretion.com">sebastien.beau&#64;akretion.com</a>&gt;</li>
@@ -696,7 +667,7 @@ <h3><a class="toc-backref" href="#toc-entry-21">Contributors</a></h3>
696667
</ul>
697668
</div>
698669
<div class="section" id="maintainers">
699-
<h3><a class="toc-backref" href="#toc-entry-22">Maintainers</a></h3>
670+
<h3><a class="toc-backref" href="#toc-entry-21">Maintainers</a></h3>
700671
<p>This module is maintained by the OCA.</p>
701672
<a class="reference external image-reference" href="https://odoo-community.org">
702673
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />

0 commit comments

Comments
 (0)