Skip to content

Commit

Permalink
[MIG] fs_attachment: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenminhchien committed Mar 11, 2024
1 parent ef1a6e6 commit 79f1068
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 12 deletions.
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.1.0.9",
"version": "17.0.1.0.0",
"author": "Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"development_status": "Beta",
Expand Down
2 changes: 1 addition & 1 deletion fs_attachment/fs_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def from_fs_attachment(cls, attachment: IrAttachment) -> FsStream:
etag=attachment.checksum,
type="fs",
size=attachment.file_size,
last_modified=attachment["__last_update"],
last_modified=attachment["write_date"],
fs_attachment=attachment,
)

Expand Down
3 changes: 2 additions & 1 deletion fs_attachment/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
_logger = logging.getLogger(__name__)


def pre_init_hook(cr):
def pre_init_hook(env):
"""Pre init hook."""
# add columns for computed fields to avoid useless computation by the ORM
# when installing the module
cr = env.cr
if column_exists(cr, "ir_attachment", "fs_storage_id"):
return # columns already added; update probably failed partway
_logger.info("Add columns for computed fields on ir_attachment")
Expand Down
5 changes: 0 additions & 5 deletions fs_attachment/models/ir_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ def clean_fs(files):
_logger.info(
"_file_delete could not unlink %s", full_path, exc_info=True
)
except OSError:
# Harmless and needed for race conditions
_logger.info(
"_file_delete could not unlink %s", full_path, exc_info=True
)


class IrAttachment(models.Model):
Expand Down
1 change: 0 additions & 1 deletion fs_attachment/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
4 changes: 2 additions & 2 deletions fs_attachment/tests/test_fs_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TestFsStorage(TestFSAttachmentCommon):
@classmethod
def setUpClass(cls):
res = super().setUpClass()
cls.default_backend = cls.env.ref("fs_storage.default_fs_storage")
cls.default_backend = cls.env.ref("fs_storage.fs_storage_demo")
return res

def test_compute_model_ids(self):
Expand Down Expand Up @@ -81,7 +81,7 @@ def test_constraint_unique_storage_model(self):
self.temp_backend.model_xmlids = (
"base.model_res_partner,base.model_ir_attachment"
)
self.env.ref("fs_storage.default_fs_storage")
self.env.ref("fs_storage.fs_storage_demo")
with self.assertRaises(ValidationError):
self.default_backend.model_xmlids = "base.model_res_partner"

Expand Down
2 changes: 1 addition & 1 deletion fs_attachment/views/fs_storage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
name="force_db_for_default_attachment_rules"
widget="ace"
options="{'mode': 'python'}"
attrs="{'invisible': [('use_as_default_for_attachments', '=', False)]}"
invisible="not use_as_default_for_attachments"
/>
<separator string="Attachment's Url" />
<field name="base_url" />
Expand Down

0 comments on commit 79f1068

Please sign in to comment.