Skip to content

Commit

Permalink
[IMP] fs_file_demo: highlight use of FSImage
Browse files Browse the repository at this point in the history
  • Loading branch information
lmignon committed Sep 5, 2023
1 parent 14ca621 commit 32d4699
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion fs_file_demo/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions fs_file_demo/models/fs_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
)
6 changes: 5 additions & 1 deletion fs_file_demo/views/fs_file.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
<form>
<header />
<sheet>
<field
name="fs_image_1920"
class="oe_avatar"
options="{'preview_image': 'fs_image_128', 'zoom': true}"
/>
<group>
<field name="name" />
<field name="file" />
</group>
</sheet>
<div class="oe_chatter" />
</form>
</field>
</record>
Expand Down

0 comments on commit 32d4699

Please sign in to comment.