Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f6c4e9e
[ADD] start the module binary field in order to store correctly the b…
sebastienbeau Apr 25, 2014
6bf995b
[FIX] finish my previous work, now binaryField are working, let's do …
sebastienbeau Apr 28, 2014
2a4d260
[IMP] add support of Image
sebastienbeau Apr 28, 2014
a3ccee0
[IMP] first version of working resize image
sebastienbeau Apr 28, 2014
6d363ca
[IMP] add cache for resized image
sebastienbeau Apr 29, 2014
ffd4d87
[CLEAN] pep-8 clean up and remove dead code
sebastienbeau May 1, 2014
fbc360a
[ADD] add an example
sebastienbeau May 1, 2014
e555dd0
[REf] extract the way to build the key field
sebastienbeau May 1, 2014
c2c468a
[REF] prepare a big code refactor. First step moving all the code in …
sebastienbeau May 1, 2014
ba7b2bf
[REF] refactor remove the "binary.binary" class
sebastienbeau May 1, 2014
969075f
[IMP] add the support of the option "bin_size" in the context
sebastienbeau May 1, 2014
061bed2
[IMP] give the possibility to pass a custom Storage class. This class…
sebastienbeau May 1, 2014
a7b49f1
[FIX] fix typo, missing context and use interger for file size
sebastienbeau Jun 6, 2014
eceea5d
[IMP] add the params config so you can pass some special config to yo…
sebastienbeau Jun 6, 2014
42a6bed
[IMP] Update example module
sebastienbeau Jun 6, 2014
0dc821d
[REF] remove useless option filters as this option have been drop wit…
sebastienbeau Jun 8, 2014
abcbaf1
[IMP] update description and add doc string
sebastienbeau Jun 8, 2014
8a7665f
[IMP] PEP8
eLBati Jun 20, 2014
36cedb9
[REF] refcactor code, merge the class ImageFieldResize into the class…
sebastienbeau Jul 1, 2014
8bf91b6
[REF] refactor storage, add a new object "storage.configuration" that…
sebastienbeau Jul 1, 2014
6c37169
[FIX] fix delete methode
sebastienbeau Jul 1, 2014
fab3550
[FIX] Fix init method, original method should be call at the end
sebastienbeau Jul 1, 2014
f27c34e
[FIX] default storage should be in no update state
sebastienbeau Jul 1, 2014
84dcd10
[FIX] remove useless file added by error
sebastienbeau Jul 4, 2014
12b6d95
[IMP] add the concept of external server for serving the image
sebastienbeau Jul 8, 2014
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
Binary file added binary_field/.fields.py.swp
Binary file not shown.
25 changes: 25 additions & 0 deletions binary_field/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Module for OpenERP
# Copyright (C) 2013 Akretion (http://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################

from . import fields
from . import storage
from . import ir_model
83 changes: 83 additions & 0 deletions binary_field/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Module for OpenERP
# Copyright (C) 2013 Akretion (http://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################

{'name': 'Binary Field',
'version': '0.0.1',
'author': 'Akretion',
'website': 'www.akretion.com',
'license': 'AGPL-3',
'category': 'Framework',
'description': """This module extend the fields class in order to add 3 new
type of fields.
- BinaryStore
- ImageStore
- ImageRezise

All of this fields will be store on the file system by default and not in the
database. If you want to store it on an other support (database, S3, ftp,
SFTP...)
Then you should create your own 'storage class' and use your custom 'storage
class' instead

The default Storage class will store the field on the file system and build
the path like that

BASE_LOCATION/DB_NAME/MODEL-FIELD/XXX/YYYYY

with

- BASE_LOCATION: the base location configured in ir.config_parameter
- DB_NAME: your database name
- MODEL-FIELD: the concatenation of the name of the model with the name of the
field, for example 'product_product-image'
- XXX: the first 3 letter of the file name build with their sha1 hash
- YYYYYY: file name build with their sha1 hash

Here is an example of field declaration

'binary_test': fields.BinaryField('Test Binary'),
'image_test': fields.ImageField('Test Image',
config={
'field_key': 'StoreMeHere',
'base_location': 'file:///testpath',
}),
'image_test_resize': fields.ImageResizeField(
related_field='image_test',
string='Test Image small',
height=64,
width=64,
),
""",
'depends': [
'web',
],
'data': [
'data.xml',
'ir_model_view.xml',
'storage_view.xml',
],
'js': [
'static/src/js/widget.js',
],
'installable': True,
'application': True,
}
11 changes: 11 additions & 0 deletions binary_field/data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<record id="default_filesystem_storage" model="storage.configuration">
<field name="type">filesystem</field>
<field name="name">Default File System Storage</field>
<field name="base_path">openerp/filestore/</field>
<field name="is_default">1</field>
</record>
</data>
</openerp>
Loading