Skip to content

Commit

Permalink
😍 ir_attachment_s3: complete rewrite
Browse files Browse the repository at this point in the history
- Take away "ir.attachment.resized" model (it is in web_image_cache now)
- Module is working with S3 files like binary files, but also stores url
- Add abitlity to upload existing attachments from shell for more interactivity
- Use virtual-hosted style addressing model (Reference: https://forums.aws.amazon.com/ann.jspa?annID=6776)
  • Loading branch information
em230418 committed Jul 23, 2020
1 parent 91cb525 commit fa47493
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 538 deletions.
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ line_length=88
known_odoo=odoo
known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party=bs4,dateutil,html2text,jinja2,psycopg2,requests,requests_mock,werkzeug
known_third_party=boto3,bs4,dateutil,html2text,jinja2,psycopg2,requests,requests_mock,werkzeug
1 change: 0 additions & 1 deletion ir_attachment_s3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from . import models
from . import controllers
8 changes: 2 additions & 6 deletions ir_attachment_s3/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"summary": """Upload attachments on Amazon S3""",
"category": "Tools",
"images": [],
"version": "13.0.1.2.2",
"version": "13.0.2.0.0",
"application": False,
"author": "IT-Projects LLC, Ildar Nasyrov",
"website": "https://it-projects.info",
Expand All @@ -12,11 +12,7 @@
"currency": "EUR",
"depends": ["base_setup", "ir_attachment_url"],
"external_dependencies": {"python": ["boto3"], "bin": []},
"data": [
"data/ir_attachment_s3_data.xml",
"security/ir.model.access.csv",
"views/res_config_settings_views.xml",
],
"data": ["data/ir_attachment_s3_data.xml", "views/res_config_settings_views.xml"],
"qweb": [],
"demo": [],
"post_load": None,
Expand Down
1 change: 0 additions & 1 deletion ir_attachment_s3/controllers/__init__.py

This file was deleted.

142 changes: 0 additions & 142 deletions ir_attachment_s3/controllers/main.py

This file was deleted.

7 changes: 7 additions & 0 deletions ir_attachment_s3/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
`2.0.0`
-------
- **Improvement:** "ir.attachment.resized" model is moved to "web_image_cache" module
- **Improvement:** "Upload existing data" functionality is now also available via shell by running env["ir.attachment"].force_storage_s3()
- **Improvement:** Module is working with S3 files like binary files, but also stores url
- **Improvement:** Using virtual-hosted style addressing model instead of path-style

`1.2.2`
-------

Expand Down
7 changes: 6 additions & 1 deletion ir_attachment_s3/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ In this case you should also install ``ir_attachment_url`` module to be able to
Upload existing attachments
---------------------------

* To upload existing attachments go to the ``Settings >> Technical >> Database Structure >> S3 Settings`` menu and click on the ``[Upload existing attachments]`` button there
* There are 2 ways to upload existing attachments:
1. Open odoo shell and run `env["ir.attachment"].force_storage_s3()`
2. Go to the ``Settings >> Technical >> Database Structure >> S3 Settings`` menu and click on the ``[Upload existing attachments]`` button there

It is recommended to upload attachments via shell, because upload progress is visible in this method.

* To add link of existing S3 bucket object to binary fields of existing odoo records:

* Take ``Link`` urls from Amazon. If you open ``Overview`` of the object on Amazon you should see it at the bottom of the page
Expand Down
Loading

0 comments on commit fa47493

Please sign in to comment.