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 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": "16.0.2.1.0",
"version": "16.0.3.0.0",
"author": "Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"development_status": "Beta",
Expand Down
16 changes: 16 additions & 0 deletions fs_attachment/migrations/16.0.3.0.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
if env["ir.module.module"].search(
[("name", "=", "server_environment"), ("state", "=", "installed")]
):
openupgrade.logged_query(
env.cr,
"""
UPDATE ir_module_module
SET state = 'to install'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that really enough to get fs_attachment_environment installed during the fs_attachment upgrade?

I would've bet you need to call button_install or button_immediate_install on the ir.module.module instead.

@yankinmax, you worked on this too, do you remember what you had to do for the other modules?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed migration did not run properly for me and erased the field values for the existing "fs.storage" records in the production environment.

Not sure if this was one of the reasons.

I was able to quickly to recover the config from a backup

WHERE name = 'fs_attachment_environment' AND state = 'uninstalled'
""",
)
19 changes: 0 additions & 19 deletions fs_attachment/models/fs_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,25 +179,6 @@ def _check_field_xmlid_storage_unique(self):
% {"field": xmlid, "other_storage": other_storages[0].name}
)

@property
def _server_env_fields(self):
env_fields = super()._server_env_fields
env_fields.update(
{
"optimizes_directory_path": {},
"autovacuum_gc": {},
"base_url": {},
"is_directory_path_in_url": {},
"use_x_sendfile_to_serve_internal_url": {},
"use_as_default_for_attachments": {},
"force_db_for_default_attachment_rules": {},
"use_filename_obfuscation": {},
"model_xmlids": {},
"field_xmlids": {},
}
)
return env_fields

@property
def _default_force_db_for_default_attachment_rules(self) -> str:
return '{"image/": 51200, "application/javascript": 0, "text/css": 0}'
Expand Down
1 change: 1 addition & 0 deletions fs_attachment/tests/test_fs_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ def test_url_for_image_dir_optimized_and_not_obfuscated(self):
"name": "FS Product Image Backend",
"code": "file",
"base_url": "https://localhost/images",
"protocol": "odoofs",
"optimizes_directory_path": True,
"use_filename_obfuscation": False,
}
Expand Down
83 changes: 83 additions & 0 deletions fs_attachment_environment/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=============================
Filesystem Attachment Backend
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:bbd1be658bbe5cda3a0ca2391c1de17eafb45624ac49610b3b2503c65d2610af
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github
:target: https://github.com/OCA/storage/tree/16.0/fs_attachment_environment
:alt: OCA/storage
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/storage-16-0/storage-16-0-fs_attachment_environment
: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=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Glue module for fs_attachment to use fs_storage_environment

**Table of contents**

.. contents::
:local:

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_attachment_environment%0Aversion:%2016.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.

Credits
=======

Authors
~~~~~~~

* ACSONE SA/NV
* Dixmit

Contributors
~~~~~~~~~~~~

* Laurent Mignon <laurent.mignon@acsone.eu>
* Sébastien BEAU <sebastien.beau@akretion.com>
* Enric Tobella

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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/16.0/fs_attachment_environment>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions fs_attachment_environment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions fs_attachment_environment/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2026 Dixmit
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Filesystem Attachment Backend",
"summary": "Allows to use server environment with fs storage attachment",
"version": "16.0.1.0.0",
"category": "FS Storage",
"website": "https://github.com/OCA/storage",
"author": " ACSONE SA/NV, Dixmit, Odoo Community Association (OCA)",
"license": "AGPL-3",
"development_status": "Beta",
"installable": True,
"depends": ["fs_storage_environment", "fs_attachment"],
"data": [],
"auto_install": True,
}
1 change: 1 addition & 0 deletions fs_attachment_environment/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import fs_storage
32 changes: 32 additions & 0 deletions fs_attachment_environment/models/fs_storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2023 ACSONE SA/NV (https://www.acsone.eu).
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from __future__ import annotations

import logging

from odoo import models

_logger = logging.getLogger(__name__)


class FSStorage(models.Model):
_inherit = "fs.storage"

@property
def _server_env_fields(self):
env_fields = super()._server_env_fields
env_fields.update(
{
"optimizes_directory_path": {},
"autovacuum_gc": {},
"base_url": {},
"is_directory_path_in_url": {},
"use_x_sendfile_to_serve_internal_url": {},
"use_as_default_for_attachments": {},
"force_db_for_default_attachment_rules": {},
"use_filename_obfuscation": {},
"model_xmlids": {},
"field_xmlids": {},
}
)
return env_fields
3 changes: 3 additions & 0 deletions fs_attachment_environment/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Laurent Mignon <laurent.mignon@acsone.eu>
* Sébastien BEAU <sebastien.beau@akretion.com>
* Enric Tobella
1 change: 1 addition & 0 deletions fs_attachment_environment/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Glue module for fs_attachment to use fs_storage_environment
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading