diff --git a/amazon_s3_connector/README.rst b/amazon_s3_connector/README.rst new file mode 100644 index 000000000..563871a04 --- /dev/null +++ b/amazon_s3_connector/README.rst @@ -0,0 +1,52 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Odoo Amazon S3 Connector +======================= +The Amazon S3 uploaded files are displayed in this module. as well as for Amazon S3 + +Configuration +============= +The user should install 'boto3', AWS sdk for python by 'pip install boto3'. +The access key and secret should be created from amazon s3, security credentials. +Bucket name as any of amazon s3 bucket name from where data to accessed or uploaded. + +Installation +============ +- www.odoo.com/documentation/16.0/setup/install.html +- Install our custom addon + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.odoo.com/documentation/user/16.0/legal/licenses/licenses.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: (v16) Aslam A K @cybrosys + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/amazon_s3_connector/__init__.py b/amazon_s3_connector/__init__.py new file mode 100644 index 000000000..9dadaaf6b --- /dev/null +++ b/amazon_s3_connector/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Aslam A K( odoo@cybrosys.com ) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# 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 (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import models +from . import wizard +from .hooks import uninstall_hook diff --git a/amazon_s3_connector/__manifest__.py b/amazon_s3_connector/__manifest__.py new file mode 100644 index 000000000..395b7e0fb --- /dev/null +++ b/amazon_s3_connector/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Aslam A K( odoo@cybrosys.com ) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# 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 (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +{ + 'name': "Odoo Amazon S3 Connector", + 'version': "16.0.1.0.0'", + 'category': "Document Management", + 'summary': """ Connect with Amazon S3 Files from Odoo""", + 'description': """This module was developed to upload to Amazon S3 Cloud + Storage as well as access files from Amazon S3 Cloud + Storage in Odoo.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'images': ['static/description/banner.png'], + 'depends': ['base_setup'], + 'data': [ + 'security/ir.model.access.csv', + 'views/amazon_dashboard_views.xml', + 'views/res_config_settings_views.xml', + 'wizard/amazon_upload_file_views.xml' + ], + 'assets': { + 'web.assets_backend': [ + 'amazon_s3_connector/static/src/js/amazon.js', + 'amazon_s3_connector/static/src/xml/amazon_dashboard_template.xml', + 'amazon_s3_connector/static/src/scss/amazon.scss' + ] + }, + 'license': 'AGPL-3', + 'external_dependencies': {'python': ['boto3']}, + 'application': True, + 'installable': True, + 'auto_install': False, + 'uninstall_hook': 'uninstall_hook' +} diff --git a/amazon_s3_connector/doc/RELEASE_NOTES.md b/amazon_s3_connector/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..6b80622a3 --- /dev/null +++ b/amazon_s3_connector/doc/RELEASE_NOTES.md @@ -0,0 +1,5 @@ +## Module +#### 11.07.2023 +#### Version 16.0.1.0.0 +#### ADD +- Initial commit for Odoo Amazon S3 Connector diff --git a/amazon_s3_connector/hooks.py b/amazon_s3_connector/hooks.py new file mode 100644 index 000000000..ecdf2da37 --- /dev/null +++ b/amazon_s3_connector/hooks.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Aslam A K( odoo@cybrosys.com ) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# 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 (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import api, SUPERUSER_ID + + +def uninstall_hook(cr, registry): + """ + Deletes System Parameters + """ + env = api.Environment(cr, SUPERUSER_ID, {}) + env['ir.config_parameter'].sudo().search( + [('key', '=', 'amazon_s3_connector.amazon_access_key')]).unlink() + env['ir.config_parameter'].sudo().search( + [('key', '=', 'amazon_s3_connector.amazon_secret_key')]).unlink() + env['ir.config_parameter'].sudo().search( + [('key', '=', 'amazon_s3_connector.amazon_bucket_name')]).unlink() + env['ir.config_parameter'].sudo().search( + [('key', '=', 'amazon_s3_connector.amazon_connector')]).unlink() diff --git a/amazon_s3_connector/models/__init__.py b/amazon_s3_connector/models/__init__.py new file mode 100644 index 000000000..7e710d63d --- /dev/null +++ b/amazon_s3_connector/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Aslam A K( odoo@cybrosys.com ) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# 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 (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import amazon_dashboard +from . import res_config_settings diff --git a/amazon_s3_connector/models/amazon_dashboard.py b/amazon_s3_connector/models/amazon_dashboard.py new file mode 100644 index 000000000..585d48282 --- /dev/null +++ b/amazon_s3_connector/models/amazon_dashboard.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Aslam A K( odoo@cybrosys.com ) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# 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 (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +import boto3 +import os +from odoo import models + + +class AmazonDashboard(models.Model): + """ + Amazon dashboard Model to connect with amazon S3 + """ + _name = 'amazon.dashboard' + _description = "Amazon Dashboard" + + def amazon_view_files(self): + """ + Fetch all files from s3 and returns it. + """ + access_key = self.env['ir.config_parameter'].get_param( + 'amazon_s3_connector.amazon_access_key') + access_secret = self.env['ir.config_parameter'].get_param( + 'amazon_s3_connector.amazon_secret_key') + bucket_name = self.env['ir.config_parameter'].get_param( + 'amazon_s3_connector.amazon_bucket_name') + if not access_key or not access_secret or not bucket_name: + return False + try: + client = boto3.client('s3', aws_access_key_id=access_key, + aws_secret_access_key=access_secret) + region = client.get_bucket_location(Bucket=bucket_name) + client = boto3.client( + 's3', region_name=region['LocationConstraint'], + aws_access_key_id=access_key, + aws_secret_access_key=access_secret + ) + response = client.list_objects(Bucket=bucket_name) + file = [] + for data in response['Contents']: + url = client.generate_presigned_url( + ClientMethod='get_object', + Params={'Bucket': bucket_name, 'Key': data['Key']}) + if data['Size'] == 0: + continue + size_bytes = data['Size'] / 1024 + if size_bytes > 1024: + size = str( + round(data['Size'] / (1024 * 1024), 1)) + ' MB' + else: + size = str(round(data['Size'] / 1024, 1)) + ' KB' + file_type = str.upper( + os.path.splitext(data['Key'])[1].replace('.', '')) + file.append( + [data['Key'], url, file_type, + str(data['LastModified']), size]) + return file + except Exception as e: + return ['e', e] diff --git a/amazon_s3_connector/models/res_config_settings.py b/amazon_s3_connector/models/res_config_settings.py new file mode 100644 index 000000000..085ebef25 --- /dev/null +++ b/amazon_s3_connector/models/res_config_settings.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Aslam A K( odoo@cybrosys.com ) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# 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 (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + """ + Configure the access credentials + """ + _inherit = 'res.config.settings' + + amazon_access_key = fields.Char(string='Amazon S3 Access Key', copy=False, + config_parameter='amazon_s3_connector.amazon_access_key', + help='Enter your Amazon S3 Access Key here.') + amazon_secret_key = fields.Char(string='Amazon S3 Secret key', + config_parameter='amazon_s3_connector.amazon_secret_key', + help='Enter your Amazon S3 Secret Key here.') + amazon_bucket_name = fields.Char(string='Folder ID', + config_parameter='amazon_s3_connector.amazon_bucket_name', + help='Enter the name of your Amazon S3 Bucket here.') + is_amazon_connector = fields.Boolean( + config_parameter='amazon_s3_connector.amazon_connector', default=False, + help='Enable or disable the Amazon S3 connector.') diff --git a/amazon_s3_connector/security/ir.model.access.csv b/amazon_s3_connector/security/ir.model.access.csv new file mode 100644 index 000000000..562ac35ca --- /dev/null +++ b/amazon_s3_connector/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_amazon_dashboard,access.amazon.dashboard,model_amazon_dashboard,base.group_user,1,1,1,1 +access_amazon_upload_file,access.amazon.upload.file,model_amazon_upload_file,base.group_user,1,1,1,1 diff --git a/amazon_s3_connector/static/description/assets/icons/check.png b/amazon_s3_connector/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/check.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/chevron.png b/amazon_s3_connector/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/chevron.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/cogs.png b/amazon_s3_connector/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/cogs.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/consultation.png b/amazon_s3_connector/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/consultation.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/ecom-black.png b/amazon_s3_connector/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/ecom-black.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/education-black.png b/amazon_s3_connector/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/education-black.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/hotel-black.png b/amazon_s3_connector/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/hotel-black.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/license.png b/amazon_s3_connector/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/license.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/lifebuoy.png b/amazon_s3_connector/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/lifebuoy.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/manufacturing-black.png b/amazon_s3_connector/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/manufacturing-black.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/pos-black.png b/amazon_s3_connector/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/pos-black.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/puzzle.png b/amazon_s3_connector/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/puzzle.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/restaurant-black.png b/amazon_s3_connector/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/restaurant-black.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/service-black.png b/amazon_s3_connector/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/service-black.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/trading-black.png b/amazon_s3_connector/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/trading-black.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/training.png b/amazon_s3_connector/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/training.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/update.png b/amazon_s3_connector/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/update.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/user.png b/amazon_s3_connector/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/user.png differ diff --git a/amazon_s3_connector/static/description/assets/icons/wrench.png b/amazon_s3_connector/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/wrench.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/categories.png b/amazon_s3_connector/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/categories.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/check-box.png b/amazon_s3_connector/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/check-box.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/compass.png b/amazon_s3_connector/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/compass.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/corporate.png b/amazon_s3_connector/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/corporate.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/customer-support.png b/amazon_s3_connector/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/customer-support.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/cybrosys-logo.png b/amazon_s3_connector/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/cybrosys-logo.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/features.png b/amazon_s3_connector/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/features.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/logo.png b/amazon_s3_connector/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/logo.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/pictures.png b/amazon_s3_connector/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/pictures.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/pie-chart.png b/amazon_s3_connector/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/pie-chart.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/right-arrow.png b/amazon_s3_connector/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/right-arrow.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/star.png b/amazon_s3_connector/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/star.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/support.png b/amazon_s3_connector/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/support.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/whatsapp.png b/amazon_s3_connector/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/whatsapp.png differ diff --git a/amazon_s3_connector/static/description/assets/modules/1.gif b/amazon_s3_connector/static/description/assets/modules/1.gif new file mode 100644 index 000000000..beb106101 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/1.gif differ diff --git a/amazon_s3_connector/static/description/assets/modules/2.png b/amazon_s3_connector/static/description/assets/modules/2.png new file mode 100644 index 000000000..25ed3e0b6 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/2.png differ diff --git a/amazon_s3_connector/static/description/assets/modules/3.png b/amazon_s3_connector/static/description/assets/modules/3.png new file mode 100644 index 000000000..ed11bd818 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/3.png differ diff --git a/amazon_s3_connector/static/description/assets/modules/4.png b/amazon_s3_connector/static/description/assets/modules/4.png new file mode 100644 index 000000000..5c56f0bcd Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/4.png differ diff --git a/amazon_s3_connector/static/description/assets/modules/5.png b/amazon_s3_connector/static/description/assets/modules/5.png new file mode 100644 index 000000000..1c98e213f Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/5.png differ diff --git a/amazon_s3_connector/static/description/assets/modules/6.png b/amazon_s3_connector/static/description/assets/modules/6.png new file mode 100644 index 000000000..eb3f8652f Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/6.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/1.png b/amazon_s3_connector/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..f02f27bad Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/1.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/2.png b/amazon_s3_connector/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..270d27035 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/2.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/3.png b/amazon_s3_connector/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..58e47f4e9 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/3.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/4.png b/amazon_s3_connector/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..12109eaa0 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/4.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/5.png b/amazon_s3_connector/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..d7a70ebc3 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/5.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/6.png b/amazon_s3_connector/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..cbfbf8423 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/6.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/7.png b/amazon_s3_connector/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..408e1ff03 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/7.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/8.png b/amazon_s3_connector/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..3793869e3 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/8.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/9.png b/amazon_s3_connector/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..47b2869e4 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/9.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/hero.gif b/amazon_s3_connector/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..0759ca4bc Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/hero.gif differ diff --git a/amazon_s3_connector/static/description/banner.png b/amazon_s3_connector/static/description/banner.png new file mode 100644 index 000000000..23c9017f7 Binary files /dev/null and b/amazon_s3_connector/static/description/banner.png differ diff --git a/amazon_s3_connector/static/description/icon.png b/amazon_s3_connector/static/description/icon.png new file mode 100644 index 000000000..72174afd9 Binary files /dev/null and b/amazon_s3_connector/static/description/icon.png differ diff --git a/amazon_s3_connector/static/description/index.html b/amazon_s3_connector/static/description/index.html new file mode 100644 index 000000000..3f8c97940 --- /dev/null +++ b/amazon_s3_connector/static/description/index.html @@ -0,0 +1,708 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ + + +

+ Odoo Amazon S3 Connector

+

+ Odoo Amazon S3 Connector allows to upload and download the files in + Amazon S3 Cloud Storage. +

+ + + +
+ + +
+
+ +
+

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ Amazon S3 or Amazon Simple Storage Service is a service offered by + Amazon Web Services (AWS) that provides object storage through a web + service interface. Integrating Amazon S3 with Odoo can provide users + with a more convenient way to store and access their files within the + Odoo platform. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Ease of File Management +
+ +
+ + Displays all the files from Amazon S3 +
+ +
+ + Upload files to Amazon S3 +
+ +
+ + Dynamic Search Bar +
+ +
+ + Filter on File type +
+ +
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Amazon S3 Access key creation. +

+

+ Login to Amazon Web Services. Goto --> Security Credentials, + Create Access key +

+ +
+ +
+

+ Access Key and Secret Access Key. +

+

+ +
+ + +
+

+ Configuration +

+

+

+ +
+ +
+

+ Dashboard View +

+

+ +
+ +
+

+ Filter on File Types +

+

+ +
+ +
+

+ Upload Files +

+

+ +
+ +
+

+ Search Console +

+

+ +
+ +
+

+ Filter Names Ascending

+

+

+ +
+ +
+

+ Filter SL NO: Ascending

+

+ +
+
+
+ + + +
+
+ +
+

+ Related + Products +

+
+
+
+ +
+
+ + + + +
+
+ +
+

+ Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+ +
+ + + + +
+
+ +
+

+ Our + Industries +

+
+ +
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+
+
+ + + + +
+
+ +
+

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/amazon_s3_connector/static/src/img/amazon_icon.png b/amazon_s3_connector/static/src/img/amazon_icon.png new file mode 100644 index 000000000..e99892e55 Binary files /dev/null and b/amazon_s3_connector/static/src/img/amazon_icon.png differ diff --git a/amazon_s3_connector/static/src/img/amazon_s3_text.png b/amazon_s3_connector/static/src/img/amazon_s3_text.png new file mode 100644 index 000000000..78584789f Binary files /dev/null and b/amazon_s3_connector/static/src/img/amazon_s3_text.png differ diff --git a/amazon_s3_connector/static/src/img/s3_icon.png b/amazon_s3_connector/static/src/img/s3_icon.png new file mode 100644 index 000000000..eae9f2bc3 Binary files /dev/null and b/amazon_s3_connector/static/src/img/s3_icon.png differ diff --git a/amazon_s3_connector/static/src/js/amazon.js b/amazon_s3_connector/static/src/js/amazon.js new file mode 100644 index 000000000..568594d5b --- /dev/null +++ b/amazon_s3_connector/static/src/js/amazon.js @@ -0,0 +1,121 @@ +odoo.define('amazon_s3_connector.dashboard', function (require) { + 'use strict'; + var AbstractAction = require('web.AbstractAction'); + var core = require('web.core'); + var rpc = require('web.rpc'); + var AmazonDashboard = AbstractAction.extend({ + template: 'AmazonDashboard', + events: { + 'click #amazon_s3_upload' : 'upload', + 'click .sort-name' : 'sort_name', + 'click .sort-number' : 'sort_number', + 'change #filter' : 'filter_files', + 'keyup .amazon_header-search-input' : 'search_file' + }, + /* Load files to dashboard from s3 */ + init() { + this._super(...arguments); + var self = this; + rpc.query({ + model: 'amazon.dashboard', + method: 'amazon_view_files', + args:[''] + }).then(function (result) { + if(!result) + { + self.do_action({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': 'Please Setup The Access Keys', + 'type': 'warning', + 'sticky': false, + } + }) + } + else if (result[0]=='e') + { + self.do_action({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': 'Failed to Load Files [ '+result[1]+' ]', + 'type': 'warning', + 'sticky': false, + } + }) + } + else{ + self.$('.amazon_s3_files').empty(); + var count=1; + $.each(result,function(index, name){ + self.$('.amazon_s3_files').append(''+count+''+name[0]+''+name[2]+''+name[3]+''+name[4]+''); + count ++; + }); + } + }); + }, + /* Sort file names in ascending */ + sort_name: function(ev) { + var table = this.$("#files_table tbody"); + var rows = table.find("tr").toArray(); + + rows.sort(function(a, b) { + var x = $(a).find("td:eq(1)").text().toLowerCase(); + var y = $(b).find("td:eq(1)").text().toLowerCase(); + return x.localeCompare(y); + }); + table.append(rows); + }, + /* Sort Serial Numbers in ascending */ + sort_number: function (ev){ + var sorted = this.$('#files_table tbody tr').sort(function(a, b) { + var a = $(a).find('td:first').text(), b = $(b).find('td:first').text(); + return a.localeCompare(b, false, {numeric: true}) + }) + this.$('#files_table tbody').html(sorted) + }, + /* Upload files to amazon s3 */ + upload: function (ev) { + /* calls wizard action */ + this.do_action({ + name: "Upload File", + type: 'ir.actions.act_window', + res_model: 'amazon.upload.file', + view_mode: 'form', + view_type: 'form', + views: [[false, 'form']], + target: 'new', + }); + }, + /* Search console function */ + search_file: function (ev) { + var value = this.$('.amazon_header-search-input').val().toLowerCase() + this.$('.file_row').filter(function () { + $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) + }); + }, + /* Filter on basis of file type */ + filter_files: function(ev) { + var e = this.$("#filter").get(0); + this.$('.file_row').each(function(index, name) { + $(this).hide(); + var file_name = $(name).find('a').text(); + var file_type = file_name.slice((file_name.lastIndexOf(".") - 1 >>> 0) + 2); + if (e.value === 'ALL FILES') { $(this).show(); } + else if (e.value === file_type) { $(this).show(); } + else if (e.value === 'image') { + if (file_type === 'jpeg' || file_type === 'jpg' || file_type === 'png') { + $(this).show(); + } + } else if (e.value === 'txt') { + if (file_type === 'txt' || file_type === 'docx') { + $(this).show(); + } + } + }); + }, + }); + core.action_registry.add("amazon_dashboard", AmazonDashboard); + return AmazonDashboard; +}); diff --git a/amazon_s3_connector/static/src/scss/amazon.scss b/amazon_s3_connector/static/src/scss/amazon.scss new file mode 100644 index 000000000..ddf5d8bf6 --- /dev/null +++ b/amazon_s3_connector/static/src/scss/amazon.scss @@ -0,0 +1,41 @@ +.amazon_upload{ + background-color: #9e131e; + color: white; + border-radius: 5px; + width: 100px; + margin-left: 16px; + margin-top: -42px; + font-weight: bold; + font-size: 12px; + color: white; +} + +.download_file{ + margin-left:10px; +} + +.amazon_header-search-input{ + border-radius: 0.5rem; + height: 30px; + width: 400px; + outline: none; + border: none; + font-size: 15px; + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5); + margin-left: 250px; +} +.amazon_content{ + overflow-y: scroll; + height: 82vh; + width: 100vw; + } + +.files_select{ + border-radius: 0.5rem; + height: 30px; + outline: none; + border: none; + font-size: 15px; + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5); + margin-left: 10px; + } diff --git a/amazon_s3_connector/static/src/xml/amazon_dashboard_template.xml b/amazon_s3_connector/static/src/xml/amazon_dashboard_template.xml new file mode 100644 index 000000000..ecd92da1a --- /dev/null +++ b/amazon_s3_connector/static/src/xml/amazon_dashboard_template.xml @@ -0,0 +1,47 @@ + + + diff --git a/amazon_s3_connector/views/amazon_dashboard_views.xml b/amazon_s3_connector/views/amazon_dashboard_views.xml new file mode 100644 index 000000000..271a612c0 --- /dev/null +++ b/amazon_s3_connector/views/amazon_dashboard_views.xml @@ -0,0 +1,13 @@ + + + + + Amazon S3 Dashboard + amazon_dashboard + current + + + diff --git a/amazon_s3_connector/views/res_config_settings_views.xml b/amazon_s3_connector/views/res_config_settings_views.xml new file mode 100644 index 000000000..8775cb9c7 --- /dev/null +++ b/amazon_s3_connector/views/res_config_settings_views.xml @@ -0,0 +1,48 @@ + + + + + + res.config.settings.view.form.inherit.amazon.s3.connector + + res.config.settings + + + +
+
+ +
+
+
+
+ + Access key: + + +
+
+ + Secret access key: + + +
+
+ + Bucket Name: + + +
+
+
+
+
+
diff --git a/amazon_s3_connector/wizard/__init__.py b/amazon_s3_connector/wizard/__init__.py new file mode 100644 index 000000000..f3161ac8d --- /dev/null +++ b/amazon_s3_connector/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Aslam A K( odoo@cybrosys.com ) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# 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 (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import amazon_upload_file diff --git a/amazon_s3_connector/wizard/amazon_upload_file.py b/amazon_s3_connector/wizard/amazon_upload_file.py new file mode 100644 index 000000000..1e0a6adeb --- /dev/null +++ b/amazon_s3_connector/wizard/amazon_upload_file.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Aslam A K( odoo@cybrosys.com ) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# 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 (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +import boto3 +from odoo import fields, models +from odoo.exceptions import ValidationError + + +class AmazonUploadFile(models.TransientModel): + """ + For opening wizard view + """ + _name = "amazon.upload.file" + _description = "Amazon Upload File" + + file = fields.Binary(string="Attachment", help="Select a file to upload") + file_name = fields.Char(string="File Name", + help="Name of the file to upload") + + def action_amazon_upload(self): + """ + Uploads file to Amazon S3 + """ + attachment = self.env["ir.attachment"].search( + ['|', ('res_field', '!=', False), ('res_field', '=', False), + ('res_id', '=', self.id), + ('res_model', '=', 'amazon.upload.file')]) + try: + client = boto3.resource( + 's3', + aws_access_key_id=self.env['ir.config_parameter'].get_param( + 'amazon_s3_connector.amazon_access_key'), + aws_secret_access_key=self.env[ + 'ir.config_parameter'].get_param( + 'amazon_s3_connector.amazon_secret_key')) + client.Bucket(self.env['ir.config_parameter'].get_param( + 'amazon_s3_connector.amazon_bucket_name')).put_object( + Key=self.file_name, + Body=open((attachment._full_path(attachment.store_fname)), + 'rb')) + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'success', + 'message': 'File has been uploaded successfully. ' + 'Please refresh the page.', + 'next': {'type': 'ir.actions.act_window_close'}, + } + } + except Exception as e: + raise ValidationError( + 'Failed to Upload Files ( %s .)' % e) diff --git a/amazon_s3_connector/wizard/amazon_upload_file_views.xml b/amazon_s3_connector/wizard/amazon_upload_file_views.xml new file mode 100644 index 000000000..10dc22369 --- /dev/null +++ b/amazon_s3_connector/wizard/amazon_upload_file_views.xml @@ -0,0 +1,24 @@ + + + + + amazon.upload.file.view.form + amazon.upload.file + +
+ + + + + +
+
+
+