From a349d27e5e7fe76975f275bfc83153292b13835d Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Sun, 3 Sep 2023 15:44:51 +0200 Subject: [PATCH] [IMP] fs_file_demo: highlight use of FSImage --- fs_file_demo/__manifest__.py | 3 ++- fs_file_demo/models/fs_file.py | 12 ++++++++++++ fs_file_demo/views/fs_file.xml | 6 +++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/fs_file_demo/__manifest__.py b/fs_file_demo/__manifest__.py index f987579cbc..5795e20737 100644 --- a/fs_file_demo/__manifest__.py +++ b/fs_file_demo/__manifest__.py @@ -3,13 +3,14 @@ { "name": "Fs File Demo", - "summary": """Demo addon for fs_file""", + "summary": """Demo addon for fs_file and fs_image""", "version": "16.0.1.0.0", "license": "AGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/storage", "depends": [ "fs_file", + "fs_image", ], "data": [ "security/fs_file.xml", diff --git a/fs_file_demo/models/fs_file.py b/fs_file_demo/models/fs_file.py index 8fd747a9b8..5c0fc83183 100644 --- a/fs_file_demo/models/fs_file.py +++ b/fs_file_demo/models/fs_file.py @@ -4,6 +4,7 @@ from odoo import fields, models from odoo.addons.fs_file import fields as fs_fields +from odoo.addons.fs_image import fields as fs_image_fields class FsFile(models.Model): @@ -13,3 +14,14 @@ class FsFile(models.Model): name = fields.Char() file = fs_fields.FSFile(string="File") + + fs_image_1920 = fs_image_fields.FSImage( + string="Image", max_width=1920, max_height=1920 + ) + fs_image_128 = fs_image_fields.FSImage( + string="Image", + max_width=128, + max_height=128, + related="fs_image_1920", + store=True, + ) diff --git a/fs_file_demo/views/fs_file.xml b/fs_file_demo/views/fs_file.xml index 030150e2d7..3efd6a710a 100644 --- a/fs_file_demo/views/fs_file.xml +++ b/fs_file_demo/views/fs_file.xml @@ -10,12 +10,16 @@
+ -