Skip to content

Commit

Permalink
[BOT] post-merge updates
Browse files Browse the repository at this point in the history
  • Loading branch information
OCA-git-bot committed Feb 14, 2025
1 parent 47db1c4 commit 87e522c
Show file tree
Hide file tree
Showing 7 changed files with 378 additions and 382 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Available addons
----------------
addon | version | maintainers | summary
--- | --- | --- | ---
[fs_attachment](fs_attachment/) | 18.0.1.2.1 | [![lmignon](https://github.com/lmignon.png?size=30px)](https://github.com/lmignon) | Store attachments on external object store
[fs_storage](fs_storage/) | 18.0.1.0.1 | | Implement the concept of Storage with amazon S3, sftp...
[fs_attachment](fs_attachment/) | 18.0.1.2.2 | [![lmignon](https://github.com/lmignon.png?size=30px)](https://github.com/lmignon) | Store attachments on external object store
[fs_storage](fs_storage/) | 18.0.1.0.2 | | Implement the concept of Storage with amazon S3, sftp...
[storage_backend](storage_backend/) | 18.0.1.0.0 | | Implement the concept of Storage with amazon S3, sftp...
[storage_backend_sftp](storage_backend_sftp/) | 18.0.1.0.0 | | Implement SFTP Storage
[storage_file](storage_file/) | 18.0.1.0.0 | | Storage file in storage backend
Expand Down
418 changes: 208 additions & 210 deletions fs_attachment/README.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fs_attachment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Base Attachment Object Store",
"summary": "Store attachments on external object store",
"version": "18.0.1.2.1",
"version": "18.0.1.2.2",
"author": "Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"development_status": "Beta",
Expand Down
110 changes: 54 additions & 56 deletions fs_attachment/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Base Attachment Object Store</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:056fa2596fdf1ec0126b04e83f274ca93cbea77c5c82e5f3792affe1189682dc
!! source digest: sha256:86c34bac2794d20a45fde87fd298e0f311d5f8e1e514c9b454caafb4ffec771d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/storage/tree/18.0/fs_attachment"><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-18-0/storage-18-0-fs_attachment"><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=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>In some cases, you need to store attachment in another system that the
Expand All @@ -390,8 +390,8 @@ <h1 class="title">Base Attachment Object Store</h1>
<ul class="simple">
<li><tt class="docutils literal">Internal URL</tt>: URL to retrieve the file content from the Odoo’s
filestore.</li>
<li><tt class="docutils literal">Filesystem URL</tt>: URL to retrieve the file content from the
external storage.</li>
<li><tt class="docutils literal">Filesystem URL</tt>: URL to retrieve the file content from the external
storage.</li>
</ul>
<p>Note</p>
<p>The internal URL is always available, but the filesystem URL is only
Expand Down Expand Up @@ -457,23 +457,22 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
<li><p class="first"><tt class="docutils literal">Optimizes Directory Path</tt>: This option is useful if you need to
prevent having too many files in a single directory. It will create a
directory structure based on the attachment’s checksum (with 2 levels
of depth) For example, if the checksum is <tt class="docutils literal">123456789</tt>, the file
will be stored in the directory
<tt class="docutils literal"><span class="pre">/path/to/storage/12/34/my_file-1-0.txt</span></tt>.</p>
of depth) For example, if the checksum is <tt class="docutils literal">123456789</tt>, the file will
be stored in the directory <tt class="docutils literal"><span class="pre">/path/to/storage/12/34/my_file-1-0.txt</span></tt>.</p>
</li>
<li><p class="first"><tt class="docutils literal">Autovacuum GC</tt>: This is used to automatically remove files from
the filesystem when it’s no longer referenced in Odoo. Some storage
<li><p class="first"><tt class="docutils literal">Autovacuum GC</tt>: This is used to automatically remove files from the
filesystem when it’s no longer referenced in Odoo. Some storage
backends (like S3) may charge you for the storage of files, so it’s
important to remove them when they’re no longer needed. In some
cases, this option is not desirable, for example if you’re using a
storage backend to store images shared with others systems (like your
website) and you don’t want to remove the files from the storage
while they’re still referenced into the others systems. This
mechanism is based on a <tt class="docutils literal">fs.file.gc</tt> model used to collect the
files to remove. This model is automatically populated by the
<tt class="docutils literal">ir.attachment</tt> model when a file is removed from the database. If
you disable this option, you’ll have to manually take care of the
records in the <tt class="docutils literal">fs.file.gc</tt> for your filesystem storage.</p>
important to remove them when they’re no longer needed. In some cases,
this option is not desirable, for example if you’re using a storage
backend to store images shared with others systems (like your website)
and you don’t want to remove the files from the storage while they’re
still referenced into the others systems. This mechanism is based on a
<tt class="docutils literal">fs.file.gc</tt> model used to collect the files to remove. This model
is automatically populated by the <tt class="docutils literal">ir.attachment</tt> model when a file
is removed from the database. If you disable this option, you’ll have
to manually take care of the records in the <tt class="docutils literal">fs.file.gc</tt> for your
filesystem storage.</p>
</li>
<li><p class="first"><tt class="docutils literal">Use As Default For Attachment</tt>: This options allows you to declare
the storage as the default one for attachments. If you have multiple
Expand All @@ -486,8 +485,8 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
even if you have a default filesystem storage configured. This is
specially useful when you’re using a storage backend like S3, where
the latency of the network can be high. This option is a JSON field
that allows you to define the mimetypes and the size limit below
which the attachments will be stored in the database.</p>
that allows you to define the mimetypes and the size limit below which
the attachments will be stored in the database.</p>
<p>Small images (128, 256) are used in Odoo in list / kanban views. We
want them to be fast to read. They are generally &lt; 50KB (default
configuration) so they don’t take that much space in database, but
Expand All @@ -503,14 +502,14 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
<p>The default configuration is:</p>
<blockquote>
<p>{“image/”: 51200, “application/javascript”: 0, “text/css”: 0}</p>
<p>Where the key is the beginning of the mimetype to configure and
the value is the limit in size below which attachments are kept in
DB. 0 means no limit.</p>
<p>Where the key is the beginning of the mimetype to configure and the
value is the limit in size below which attachments are kept in DB.
0 means no limit.</p>
</blockquote>
<p>Default configuration means:</p>
<ul class="simple">
<li>images mimetypes (image/png, image/jpeg, …) below 50KB are
stored in database</li>
<li>images mimetypes (image/png, image/jpeg, …) below 50KB are stored
in database</li>
<li>application/javascript are stored in database whatever their size</li>
<li>text/css are stored in database whatever their size</li>
</ul>
Expand All @@ -530,16 +529,16 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
the one where the model is explicitely linked.</li>
<li>From a server environment file: In this case you just have to provide
a comma-separated list of models (under the model_xmlids key) or
fields (under the field_xmlids key). To do so, use the model/field
XML ids provided by Odoo. See the Server Environment section for a
fields (under the field_xmlids key). To do so, use the model/field XML
ids provided by Odoo. See the Server Environment section for a
concrete example.</li>
</ul>
<p>Another key feature of this module is the ability to get access to the
attachments from URLs.</p>
<ul>
<li><p class="first"><tt class="docutils literal">Base URL</tt>: This is the base URL used to access the attachments
from the filesystem storage itself. If your storage doesn’t provide a
way to access the files from a URL, you can leave this field empty.</p>
<li><p class="first"><tt class="docutils literal">Base URL</tt>: This is the base URL used to access the attachments from
the filesystem storage itself. If your storage doesn’t provide a way
to access the files from a URL, you can leave this field empty.</p>
</li>
<li><p class="first"><tt class="docutils literal">Is Directory Path In URL</tt>: Normally the directory patch configured
on the storage is not included in the URL. If you want to include it,
Expand All @@ -550,26 +549,25 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
attachment’s internal URL will be served by the proxy using the
filesystem url path if defined (This field is available on the
attachment if the storage is configured with a base URL) If not, the
file will be served by odoo that will stream the content read from
the filesystem storage. This option is useful to avoid to serve files
from odoo and therefore to avoid to load the odoo process.</p>
file will be served by odoo that will stream the content read from the
filesystem storage. This option is useful to avoid to serve files from
odoo and therefore to avoid to load the odoo process.</p>
<p>To be fully functional, this option requires the proxy to support
x-sendfile (apache) or x-accel-redirect (nginx). You must also
configure your proxy by adding for each storage a rule to redirect
the url rooted at the ‘storagge code’ to the server serving the
files. For example, if you have a storage with the code ‘my_storage’
and a server serving the files at the url ‘<a class="reference external" href="http://myserver.com">http://myserver.com</a>’, you
must add the following rule in your proxy configuration:</p>
configure your proxy by adding for each storage a rule to redirect the
url rooted at the ‘storagge code’ to the server serving the files. For
example, if you have a storage with the code ‘my_storage’ and a server
serving the files at the url ‘<a class="reference external" href="http://myserver.com">http://myserver.com</a>’, you must add the
following rule in your proxy configuration:</p>
<pre class="code nginx literal-block">
<span class="k">location</span><span class="w"> </span><span class="s">/my_storage/</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="kn">internal</span><span class="p">;</span><span class="w">
</span><span class="kn">proxy_pass</span><span class="w"> </span><span class="s">http://myserver.com</span><span class="p">;</span><span class="w">
</span><span class="p">}</span>
</pre>
<p>With this configuration a call to
‘/web/content/&lt;att.id&gt;/&lt;att.name&gt;&lt;att.extension&gt;” for a file stored
in the ‘my_storage’ storage will generate a response by odoo with the
URI
‘/web/content/&lt;att.id&gt;/&lt;att.name&gt;&lt;att.extension&gt;” for a file stored in
the ‘my_storage’ storage will generate a response by odoo with the URI
<tt class="docutils literal"><span class="pre">/my_storage/&lt;paht_in_storage&gt;/&lt;att.name&gt;-&lt;att.id&gt;-&lt;version&gt;&lt;att.extension&gt;</span></tt>
in the headers <tt class="docutils literal"><span class="pre">X-Accel-Redirect</span></tt> and <tt class="docutils literal"><span class="pre">X-Sendfile</span></tt> and the proxy
will redirect to
Expand All @@ -580,12 +578,12 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
</li>
<li><p class="first"><tt class="docutils literal">Use Filename Obfuscation</tt>: If checked, the filename used to store
the content into the filesystem storage will be obfuscated. This is
useful to avoid to expose the real filename of the attachments
outside of the Odoo database. The filename will be obfuscated by
using the checksum of the content. This option is to avoid when the
content of your filestore is shared with other systems (like your
website) and you want to keep a meaningful filename to ensure SEO.
This option is disabled by default.</p>
useful to avoid to expose the real filename of the attachments outside
of the Odoo database. The filename will be obfuscated by using the
checksum of the content. This option is to avoid when the content of
your filestore is shared with other systems (like your website) and
you want to keep a meaningful filename to ensure SEO. This option is
disabled by default.</p>
</li>
</ul>
</div>
Expand Down Expand Up @@ -670,10 +668,10 @@ <h2><a class="toc-backref" href="#toc-entry-5">Tips &amp; Tricks</a></h2>
<p>To do so, you can add on your staging instances a new storage and
declare it as the default storage to use for attachments. This way,
all the new attachments will be stored in this new storage but the
attachments created on the production instance will still be read
from the production storage. Be careful to adapt the configuration of
your storage to the production environment to make it read only. (The
use of server environment files is a good way to do so).</p>
attachments created on the production instance will still be read from
the production storage. Be careful to adapt the configuration of your
storage to the production environment to make it read only. (The use
of server environment files is a good way to do so).</p>
</li>
</ul>
</div>
Expand All @@ -687,9 +685,9 @@ <h3><a class="toc-backref" href="#toc-entry-8">Bugfixes</a></h3>
<ul>
<li><p class="first">No crash o missign file.</p>
<p>Prior to this change, Odoo was crashing as soon as access to a file
stored into an external filesytem was not possible. This can lead to
a complete system block. This change prevents this kind of blockage
by ignoring access error to files stored into external system on read
stored into an external filesytem was not possible. This can lead to a
complete system block. This change prevents this kind of blockage by
ignoring access error to files stored into external system on read
operations. These kind of errors are logged into the log files for
traceability. (<a class="reference external" href="https://github.com/OCA/storage/issues/361">#361</a>)</p>
</li>
Expand All @@ -714,8 +712,8 @@ <h2><a class="toc-backref" href="#toc-entry-10">16.0.1.0.6 (2023-12-02)</a></h2>
<p>Before this change, when the fs_url was computed the computed value
was always reassigned to the fs_url attribute even if the value was
the same. In a lot of cases the value was the same and the
reassignment was not necessary. Unfortunately this reassignment has
as side effect to mark the record as dirty and generate a SQL update
reassignment was not necessary. Unfortunately this reassignment has as
side effect to mark the record as dirty and generate a SQL update
statement at the end of the transaction.
(<a class="reference external" href="https://github.com/OCA/storage/issues/307">#307</a>)</p>
</li>
Expand Down
Loading

0 comments on commit 87e522c

Please sign in to comment.