diff --git a/amazon_s3_connector/README.rst b/amazon_s3_connector/README.rst new file mode 100644 index 000000000..2dc2d35d2 --- /dev/null +++ b/amazon_s3_connector/README.rst @@ -0,0 +1,54 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://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/17.0/setup/install.html +- Install our custom addon + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: (v16) Aslam A K, + (v17) Anfas Faisal K +Contact: odoo@cybrosys.com + +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..e1b7b3900 --- /dev/null +++ b/amazon_s3_connector/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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..3f97ce6bf --- /dev/null +++ b/amazon_s3_connector/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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': "17.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", + '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' + ] + }, + 'external_dependencies': {'python': ['boto3']}, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': True, + '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..5f266f39f --- /dev/null +++ b/amazon_s3_connector/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module +#### 09.01.2024 +#### Version 17.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..86674526c --- /dev/null +++ b/amazon_s3_connector/hooks.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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 . +# +################################################################################ +def uninstall_hook(env): + """ + Deletes System Parameters + """ + 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..83cd49d1d --- /dev/null +++ b/amazon_s3_connector/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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..0e0eb3cd5 --- /dev/null +++ b/amazon_s3_connector/models/amazon_dashboard.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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..a9dd2538c --- /dev/null +++ b/amazon_s3_connector/models/res_config_settings.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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..656cbee16 --- /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_group_user,access.amazon.dashboard.group.user,model_amazon_dashboard,base.group_user,1,1,1,1 +access_amazon_upload_file_group_user,access.amazon.upload.file.group.user,model_amazon_upload_file,base.group_user,1,1,1,1 diff --git a/amazon_s3_connector/static/description/assets/icons/capture (1).png b/amazon_s3_connector/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/capture (1).png differ 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/img.png b/amazon_s3_connector/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/img.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/photo-capture.png b/amazon_s3_connector/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/icons/photo-capture.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/Cybrosys R.png b/amazon_s3_connector/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/misc/Cybrosys R.png differ diff --git a/amazon_s3_connector/static/description/assets/misc/email.svg b/amazon_s3_connector/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/amazon_s3_connector/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/amazon_s3_connector/static/description/assets/misc/phone.svg b/amazon_s3_connector/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/amazon_s3_connector/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/amazon_s3_connector/static/description/assets/misc/star (1) 2.svg b/amazon_s3_connector/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/amazon_s3_connector/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/amazon_s3_connector/static/description/assets/misc/support (1) 1.svg b/amazon_s3_connector/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/amazon_s3_connector/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/amazon_s3_connector/static/description/assets/misc/support-email.svg b/amazon_s3_connector/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/amazon_s3_connector/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/amazon_s3_connector/static/description/assets/misc/tick-mark.svg b/amazon_s3_connector/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/amazon_s3_connector/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/amazon_s3_connector/static/description/assets/misc/whatsapp 1.svg b/amazon_s3_connector/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/amazon_s3_connector/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/amazon_s3_connector/static/description/assets/misc/whatsapp.svg b/amazon_s3_connector/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/amazon_s3_connector/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/amazon_s3_connector/static/description/assets/modules/1.jpg b/amazon_s3_connector/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..fcec98d16 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/1.jpg differ diff --git a/amazon_s3_connector/static/description/assets/modules/2.jpg b/amazon_s3_connector/static/description/assets/modules/2.jpg new file mode 100644 index 000000000..0dc7bd518 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/2.jpg differ diff --git a/amazon_s3_connector/static/description/assets/modules/3.jpg b/amazon_s3_connector/static/description/assets/modules/3.jpg new file mode 100644 index 000000000..1e087eed6 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/3.jpg differ diff --git a/amazon_s3_connector/static/description/assets/modules/4.jpg b/amazon_s3_connector/static/description/assets/modules/4.jpg new file mode 100644 index 000000000..677f72279 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/4.jpg differ diff --git a/amazon_s3_connector/static/description/assets/modules/5.jpg b/amazon_s3_connector/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..1f3f2e27f Binary files /dev/null and b/amazon_s3_connector/static/description/assets/modules/5.jpg 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..6374af317 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/10.png b/amazon_s3_connector/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..0be7db8e4 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/10.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/11.png b/amazon_s3_connector/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..61e96b3fd Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/11.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/12.png b/amazon_s3_connector/static/description/assets/screenshots/12.png new file mode 100644 index 000000000..e25d651cf Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/12.png differ diff --git a/amazon_s3_connector/static/description/assets/screenshots/13.png b/amazon_s3_connector/static/description/assets/screenshots/13.png new file mode 100644 index 000000000..871d95c85 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/13.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..363904c2d 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..c18dd4857 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..fb340af7f 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..7c43242d9 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..9a831ea5d 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..0db91ded0 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..c2580d624 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-v17.gif b/amazon_s3_connector/static/description/assets/screenshots/hero-v17.gif new file mode 100644 index 000000000..4f68fbd37 Binary files /dev/null and b/amazon_s3_connector/static/description/assets/screenshots/hero-v17.gif differ diff --git a/amazon_s3_connector/static/description/banner.jpg b/amazon_s3_connector/static/description/banner.jpg new file mode 100644 index 000000000..4ddb531ee Binary files /dev/null and b/amazon_s3_connector/static/description/banner.jpg 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..cf7c3ecf2 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..a9daad819 --- /dev/null +++ b/amazon_s3_connector/static/description/index.html @@ -0,0 +1,698 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Odoo Amazon S3 Connector +

+

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

+
+ +
+
+
+
+
+

Key Highlights +

+
+
+
+
+
+ +
+
+

Ease of File Management.

+
+
+
+
+
+
+ +
+
+

Displays all the files from Amazon S3.

+
+
+
+
+
+
+ +
+
+

Upload files to Amazon S3.

+
+
+
+
+
+
+ +
+
+

Dynamic Search Bar

+
+
+
+
+
+
+ +
+
+

Filter on File type

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

+ To set up an account on Amazon S3, please follow the registration process provided on the official Amazon S3 website using the following link: Official Amazon S3 Registration

+
+
+
+
+
+
+ +
+
+

+ 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

+
+
+
+
+
+
+
    +
  • + Ease of File Management +
  • +
  • + Displays all the files from Amazon S3 +
  • +
  • + Upload files to Amazon S3 + +
  • +
  • + Dynamic Search Bar +
  • +
  • + Filter on File type + +
  • + +
+
+
+
+
+
+
Version + 16.0.1.0.0|Released on:25th May 2023 +
+

+ + Initial Commit for Manufacturing (MRP) Timesheet.

+
+
+
+
+
+
+
+

Related Products

+
+
+ +
+
+

Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

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 + 99456767686
+
+
+
+
+
+
+
+
+ + + + + + 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..f3b70844d --- /dev/null +++ b/amazon_s3_connector/static/src/js/amazon.js @@ -0,0 +1,123 @@ +/** @odoo-module **/ +import { registry } from "@web/core/registry"; +import { session } from "@web/session"; +import { _t } from "@web/core/l10n/translation"; +import { Component } from "@odoo/owl"; +import { onWillStart, onMounted, useState, useRef } from "@odoo/owl"; +import { useService } from "@web/core/utils/hooks"; + +const actionRegistry = registry.category("actions"); + +export class AmazonDashboard extends Component { + setup() { + super.setup(...arguments); + this.orm = useService('orm'); + this.user = useService("user"); + this.actionService = useService("action"); + this.rootRef = useRef("root"); + + onWillStart(async () => { + await this.fetch_data(); + }); + } + /* Appends files retrieved by function(import_files) to div files */ + async fetch_data() { + var self = this.actionService; + this.orm.call('amazon.dashboard','amazon_view_files',[''] + ).then(function (result) { + if (!result) { + self.doAction({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': 'Please Setup The Access Keys', + 'type': 'warning', + 'sticky': false, + } + }); + } else if (result[0] === 'e') { + self.doAction({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': 'Failed to Load Files [ ' + result[1] + ' ]', + 'type': 'warning', + 'sticky': false, + } + }); + } + else{ + $('.amazon_s3_files').empty(); + var count=1; + $.each(result,function(index, name){ + $('.amazon_s3_files').append(''+count+''+name[0]+''+name[2]+''+name[3]+''+name[4]+''); + count ++; + }); + } + }); + } + /* Sort file names in ascending */ + sort_name(ev) { + var table = $("#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); + } + /* Calls upload function on click of upload */ + upload(ev) { + var self = this; + self.actionService.doAction({ + name: "Upload File", + type: 'ir.actions.act_window', + res_model: 'amazon.upload.file', + view_mode: 'form', + view_type: 'form', + views: [[false, 'form']], + target: 'new', + }); + } + /* Sort Number function */ + sort_number(ev){ + var sorted = $('#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}) + }) + $('#files_table tbody').html(sorted) + } + /* Search console function */ + search_file (ev) { + var value = $('.amazon_header-search-input').val().toLowerCase() + $('.file_row').filter(function () { + $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) + }); + } + + /* Filter on basis of file type */ + filter_files(ev) { + var e = $("#filter").get(0); + $('.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(); + } + } + }); + } +} + +AmazonDashboard.template = "AmazonDashboard"; +registry.category("actions").add("amazon_dashboard", 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..c48326aa1 --- /dev/null +++ b/amazon_s3_connector/static/src/xml/amazon_dashboard_template.xml @@ -0,0 +1,48 @@ + + + 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..7cab4a2ae --- /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..301ef5af8 --- /dev/null +++ b/amazon_s3_connector/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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..8dbae90a2 --- /dev/null +++ b/amazon_s3_connector/wizard/amazon_upload_file.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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 + +
+ + + + + +
+
+
+