diff --git a/dropbox_integration/README.rst b/dropbox_integration/README.rst new file mode 100644 index 000000000..efb6d0c9f --- /dev/null +++ b/dropbox_integration/README.rst @@ -0,0 +1,43 @@ +.. 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 + +Dropbox Integration +=================== +The Dropbox files are displayed in this module. as well as in Dropbox + +Configuration +============= +The user should create Dropbox client id, Dropbox secret from Dropbox Developer page with appropriate scopes. +Folder Id is the Name of folder in Dropbox. +Generate the auth code from Configuration settings and save the credentials. + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer: Aslam A K @cybrosys, 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 `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/dropbox_integration/__init__.py b/dropbox_integration/__init__.py new file mode 100644 index 000000000..9dadaaf6b --- /dev/null +++ b/dropbox_integration/__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/dropbox_integration/__manifest__.py b/dropbox_integration/__manifest__.py new file mode 100644 index 000000000..ac1759c53 --- /dev/null +++ b/dropbox_integration/__manifest__.py @@ -0,0 +1,54 @@ +# -*- 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': "Dropbox Integration", + 'version': "16.0.1.0.0'", + 'category': "Document Management", + 'summary': """ Dropbox Odoo Integration""", + 'description': """This module was developed to upload to Dropbox as well + as access files from Dropbox in Odoo.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base', 'sale'], + 'data': [ + 'security/ir.model.access.csv', + 'views/res_config_settings_views.xml', + 'views/dashboard_view.xml', + 'wizard/authentication_wizard_views.xml', + 'wizard/dropbox_upload_views.xml' + ], + 'assets': { + 'web.assets_backend': [ + '/dropbox_integration/static/src/js/dropbox.js', + '/dropbox_integration/static/src/xml/dropbox_dashboard.xml', + '/dropbox_integration/static/src/scss/dropbox.scss', + ]}, + 'license': 'AGPL-3', + 'external_dependencies': {'python': ['dropbox']}, + 'installable': True, + 'application': True, + 'auto_install': False, + 'images': ['static/description/banner.png'], + 'uninstall_hook': 'uninstall_hook', +} diff --git a/dropbox_integration/doc/RELEASE_NOTES.md b/dropbox_integration/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..1be2bbafd --- /dev/null +++ b/dropbox_integration/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 13.04.2023 +#### Version 16.0.1.0.0 +#### ADD + +- Initial commit for Dropbox Integration diff --git a/dropbox_integration/hooks.py b/dropbox_integration/hooks.py new file mode 100644 index 000000000..65ca5dc7a --- /dev/null +++ b/dropbox_integration/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 SUPERUSER_ID, api + + +def uninstall_hook(cr, registry): + """ + Deletes System Parameters + """ + env = api.Environment(cr, SUPERUSER_ID, {}) + env['ir.config_parameter'].sudo().search( + [('key', '=', 'dropbox_integration.client_id')]).unlink() + env['ir.config_parameter'].sudo().search( + [('key', '=', 'dropbox_integration.client_secret')]).unlink() + env['ir.config_parameter'].sudo().search( + [('key', '=', 'dropbox_integration.folder_id')]).unlink() + env['ir.config_parameter'].sudo().search( + [('key', '=', 'dropbox_integration.dropbox_button')]).unlink() diff --git a/dropbox_integration/models/__init__.py b/dropbox_integration/models/__init__.py new file mode 100644 index 000000000..9cee86fe8 --- /dev/null +++ b/dropbox_integration/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 dropbox +from . import res_config_settings diff --git a/dropbox_integration/models/dropbox.py b/dropbox_integration/models/dropbox.py new file mode 100644 index 000000000..c401df9fe --- /dev/null +++ b/dropbox_integration/models/dropbox.py @@ -0,0 +1,65 @@ +# -*- 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 dropbox +from odoo import fields, models + + +class DropboxDashboard(models.Model): + """ + Dashboard model and stores the credentials + """ + _name = 'dropbox.dashboard' + _description = 'Stores Dropbox Credentials' + + dropbox_client_id = fields.Char(string='Dropbox Client ID', + help="Dropbox Client ID") + dropbox_client_secret = fields.Char(string='Dropbox Client Secret', + help="Dropbox Client Secret") + dropbox_refresh_token = fields.Char(string='Dropbox Refresh Token', + help="Dropbox Access Token") + dropbox_access_token = fields.Char(string='Dropbox Access Token', + help="Dropbox Refresh Token") + dropbox_expire_date = fields.Datetime(string='Dropbox Expiry Date', + help="Dropbox Token expiry date") + + def action_import_files(self): + """ + Import files from dropbox + """ + try: + access = self.env['dropbox.dashboard'].search([], order='id desc', + limit=1) + if not access: + return False + dbx = dropbox.Dropbox(app_key=access.dropbox_client_id, + app_secret=access.dropbox_client_secret, + oauth2_refresh_token=access.dropbox_refresh_token) + path = self.env['ir.config_parameter'].get_param( + 'dropbox_integration.folder_id') + response = dbx.files_list_folder(path=path) + data = {} + for files in response.entries: + file = dbx.files_get_temporary_link(path=files.path_lower) + data[file.metadata.name] = file.link + return data + except Exception as e: + return ['e', e] diff --git a/dropbox_integration/models/res_config_settings.py b/dropbox_integration/models/res_config_settings.py new file mode 100644 index 000000000..6ad7ff3a7 --- /dev/null +++ b/dropbox_integration/models/res_config_settings.py @@ -0,0 +1,102 @@ +# -*- 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 dropbox +from odoo import fields, models +from odoo.exceptions import ValidationError + + +class ResConfigSettings(models.TransientModel): + """ + Generates the refresh token + """ + _inherit = 'res.config.settings' + + dropbox_client_id = fields.Char(string='dropbox Client ID', copy=False, + config_parameter= + 'dropbox_integration.client_id', + help="Dropbox Client ID") + dropbox_client_secret = fields.Char(string='dropbox Client Secret', + copy=False, + config_parameter= + 'dropbox_integration.client_secret', + help="Dropbox Client Secret") + dropbox_access_token = fields.Char(string='dropbox Access Token', + help="Dropbox Access Token") + dropbox_refresh_token = fields.Char(string='dropbox Refresh Token', + help="Dropbox Refresh Token") + dropbox_token_validity = fields.Datetime(string='dropbox Token Validity', + help="Dropbox Token Validity") + dropbox_folder_id = fields.Char(string='Folder ID', + config_parameter= + 'dropbox_integration.folder_id', + help="Dropbox Folder ID") + dropbox_button = fields.Boolean( + config_parameter='dropbox_integration.dropbox_button', + default=False, help="Dropbox Button") + + def action_get_dropbox_auth_code(self): + """ + Open a wizard to set up dropbox Authorization code + """ + return { + 'type': 'ir.actions.act_window', + 'name': 'Dropbox Authorization Wizard', + 'res_model': 'authentication.wizard', + 'view_mode': 'form', + 'target': 'new', + 'context': {'dropbox_auth': True} + } + + def get_dropbox_auth_url(self): + """ + Return dropbox authorization url. + """ + dbx_auth = dropbox.oauth.DropboxOAuth2FlowNoRedirect( + self.env['ir.config_parameter'].get_param( + 'dropbox_integration.client_id'), + self.env['ir.config_parameter'].get_param( + 'dropbox_integration.client_secret'), + token_access_type='offline') + return dbx_auth.start() + + def set_dropbox_refresh_token(self, auth_code): + """ + Generate and set the dropbox refresh token from authorization code. + """ + try: + client_id = self.env['ir.config_parameter'].get_param( + 'dropbox_integration.client_id') + client_secret = self.env['ir.config_parameter'].get_param( + 'dropbox_integration.client_secret') + dbx_auth = dropbox.oauth.DropboxOAuth2FlowNoRedirect( + client_id, client_secret, + token_access_type='offline') + outh_result = dbx_auth.finish(auth_code) + self.env['dropbox.dashboard'].create({ + 'dropbox_client_id': client_id, + 'dropbox_client_secret': client_secret, + 'dropbox_refresh_token': outh_result.refresh_token, + 'dropbox_access_token': outh_result.access_token, + }) + except Exception as e: + raise ValidationError( + 'Failed to Connect with Dropbox ( %s .)' % e) diff --git a/dropbox_integration/security/ir.model.access.csv b/dropbox_integration/security/ir.model.access.csv new file mode 100644 index 000000000..1565aacf9 --- /dev/null +++ b/dropbox_integration/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_authentication_wizard,access.authentication.wizard,model_authentication_wizard,base.group_user,1,1,1,1 +access_dropbox_upload,access.dropbox.upload,model_dropbox_upload,base.group_user,1,1,1,1 +access_dropbox_dashboard,access.dropbox.dashboard,model_dropbox_dashboard,base.group_user,1,1,1,1 diff --git a/dropbox_integration/static/description/assets/icons/check.png b/dropbox_integration/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/check.png differ diff --git a/dropbox_integration/static/description/assets/icons/chevron.png b/dropbox_integration/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/chevron.png differ diff --git a/dropbox_integration/static/description/assets/icons/cogs.png b/dropbox_integration/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/cogs.png differ diff --git a/dropbox_integration/static/description/assets/icons/consultation.png b/dropbox_integration/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/consultation.png differ diff --git a/dropbox_integration/static/description/assets/icons/ecom-black.png b/dropbox_integration/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/ecom-black.png differ diff --git a/dropbox_integration/static/description/assets/icons/education-black.png b/dropbox_integration/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/education-black.png differ diff --git a/dropbox_integration/static/description/assets/icons/hotel-black.png b/dropbox_integration/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/hotel-black.png differ diff --git a/dropbox_integration/static/description/assets/icons/license.png b/dropbox_integration/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/license.png differ diff --git a/dropbox_integration/static/description/assets/icons/lifebuoy.png b/dropbox_integration/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/lifebuoy.png differ diff --git a/dropbox_integration/static/description/assets/icons/manufacturing-black.png b/dropbox_integration/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/manufacturing-black.png differ diff --git a/dropbox_integration/static/description/assets/icons/pos-black.png b/dropbox_integration/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/pos-black.png differ diff --git a/dropbox_integration/static/description/assets/icons/puzzle.png b/dropbox_integration/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/puzzle.png differ diff --git a/dropbox_integration/static/description/assets/icons/restaurant-black.png b/dropbox_integration/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/restaurant-black.png differ diff --git a/dropbox_integration/static/description/assets/icons/service-black.png b/dropbox_integration/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/service-black.png differ diff --git a/dropbox_integration/static/description/assets/icons/trading-black.png b/dropbox_integration/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/trading-black.png differ diff --git a/dropbox_integration/static/description/assets/icons/training.png b/dropbox_integration/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/training.png differ diff --git a/dropbox_integration/static/description/assets/icons/update.png b/dropbox_integration/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/update.png differ diff --git a/dropbox_integration/static/description/assets/icons/user.png b/dropbox_integration/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/user.png differ diff --git a/dropbox_integration/static/description/assets/icons/wrench.png b/dropbox_integration/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/dropbox_integration/static/description/assets/icons/wrench.png differ diff --git a/dropbox_integration/static/description/assets/misc/categories.png b/dropbox_integration/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/categories.png differ diff --git a/dropbox_integration/static/description/assets/misc/check-box.png b/dropbox_integration/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/check-box.png differ diff --git a/dropbox_integration/static/description/assets/misc/compass.png b/dropbox_integration/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/compass.png differ diff --git a/dropbox_integration/static/description/assets/misc/corporate.png b/dropbox_integration/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/corporate.png differ diff --git a/dropbox_integration/static/description/assets/misc/customer-support.png b/dropbox_integration/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/customer-support.png differ diff --git a/dropbox_integration/static/description/assets/misc/cybrosys-logo.png b/dropbox_integration/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/cybrosys-logo.png differ diff --git a/dropbox_integration/static/description/assets/misc/features.png b/dropbox_integration/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/features.png differ diff --git a/dropbox_integration/static/description/assets/misc/logo.png b/dropbox_integration/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/logo.png differ diff --git a/dropbox_integration/static/description/assets/misc/pictures.png b/dropbox_integration/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/pictures.png differ diff --git a/dropbox_integration/static/description/assets/misc/pie-chart.png b/dropbox_integration/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/pie-chart.png differ diff --git a/dropbox_integration/static/description/assets/misc/right-arrow.png b/dropbox_integration/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/right-arrow.png differ diff --git a/dropbox_integration/static/description/assets/misc/star.png b/dropbox_integration/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/star.png differ diff --git a/dropbox_integration/static/description/assets/misc/support.png b/dropbox_integration/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/support.png differ diff --git a/dropbox_integration/static/description/assets/misc/whatsapp.png b/dropbox_integration/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/dropbox_integration/static/description/assets/misc/whatsapp.png differ diff --git a/dropbox_integration/static/description/assets/modules/1.gif b/dropbox_integration/static/description/assets/modules/1.gif new file mode 100644 index 000000000..beb106101 Binary files /dev/null and b/dropbox_integration/static/description/assets/modules/1.gif differ diff --git a/dropbox_integration/static/description/assets/modules/2.png b/dropbox_integration/static/description/assets/modules/2.png new file mode 100644 index 000000000..25ed3e0b6 Binary files /dev/null and b/dropbox_integration/static/description/assets/modules/2.png differ diff --git a/dropbox_integration/static/description/assets/modules/3.png b/dropbox_integration/static/description/assets/modules/3.png new file mode 100644 index 000000000..ed11bd818 Binary files /dev/null and b/dropbox_integration/static/description/assets/modules/3.png differ diff --git a/dropbox_integration/static/description/assets/modules/4.png b/dropbox_integration/static/description/assets/modules/4.png new file mode 100644 index 000000000..5c56f0bcd Binary files /dev/null and b/dropbox_integration/static/description/assets/modules/4.png differ diff --git a/dropbox_integration/static/description/assets/modules/5.png b/dropbox_integration/static/description/assets/modules/5.png new file mode 100644 index 000000000..1c98e213f Binary files /dev/null and b/dropbox_integration/static/description/assets/modules/5.png differ diff --git a/dropbox_integration/static/description/assets/modules/6.png b/dropbox_integration/static/description/assets/modules/6.png new file mode 100644 index 000000000..eb3f8652f Binary files /dev/null and b/dropbox_integration/static/description/assets/modules/6.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/1.png b/dropbox_integration/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..cc1721c28 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/1.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/10.png b/dropbox_integration/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..37d5d680a Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/10.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/11.png b/dropbox_integration/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..1040b46b9 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/11.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/2.png b/dropbox_integration/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..7e91e60e9 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/2.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/3.png b/dropbox_integration/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..a184699c3 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/3.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/4.png b/dropbox_integration/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..9db3895e2 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/4.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/5.png b/dropbox_integration/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..90f8d8377 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/5.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/6.png b/dropbox_integration/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..e91186f92 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/6.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/7.png b/dropbox_integration/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..d471a423e Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/7.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/8.png b/dropbox_integration/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..65eaf9986 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/8.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/9.png b/dropbox_integration/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..06cb78b13 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/9.png differ diff --git a/dropbox_integration/static/description/assets/screenshots/hero.gif b/dropbox_integration/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..865d6f452 Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/hero.gif differ diff --git a/dropbox_integration/static/description/banner.png b/dropbox_integration/static/description/banner.png new file mode 100644 index 000000000..023f7926e Binary files /dev/null and b/dropbox_integration/static/description/banner.png differ diff --git a/dropbox_integration/static/description/icon.png b/dropbox_integration/static/description/icon.png new file mode 100644 index 000000000..9b96189d4 Binary files /dev/null and b/dropbox_integration/static/description/icon.png differ diff --git a/dropbox_integration/static/description/index.html b/dropbox_integration/static/description/index.html new file mode 100644 index 000000000..2d19946b1 --- /dev/null +++ b/dropbox_integration/static/description/index.html @@ -0,0 +1,715 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+
+ + + +

+ Dropbox Integration

+

+ Dropbox Integration allows to upload and download the files in Dropbox. +

+ + + +
+ + +
+
+ +
+

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ Dropbox is a file hosting service operated by the American company + Dropbox, Inc. Integrating Dropbox with Odoo can provide users with a + more convenient way to store and access their files within the Odoo + platform. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Easy File Management +
+ +
+ + Displays all files from Dropbox +
+ +
+ + Upload files to Dropbox +
+ +
+ + Dynamic Search Bar +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Dropbox api creation +

+

+ Register the app on Dropbox Developers page

+ +
+ +
+

+ API key and secret +

+

+ Redirect URIs as return web address

+ +
+ + +
+

+ Dropbox Scopes +

+

+ Read Write Scopes to access files.

+ +
+ +
+

+ Token setup +

+

+ Fill up the credentials and set up the dropbox connection with + auth code. + Goto --> Settngs--> Integrations + Provide dropbox folder name as Folder Id

+ +
+ +
+

+

+

+ Click the get auth code to generate auth code

+ +
+ +
+

+

+

+ Copy the Auth code

+ +
+ +
+

+

+

+ Paste the auth code generated from get auth code

+ +
+ +
+

+ Dropbox Integration Dashboard view

+

+

+ +
+ +
+

+ Upload files

+

+ Upload any files to Dropbox from here

+ +
+ +
+

+ Search console example

+

+

+ +
+ +
+

+ Search console example

+

+

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

+ 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

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/dropbox_integration/static/src/img/dropbox_icon.png b/dropbox_integration/static/src/img/dropbox_icon.png new file mode 100644 index 000000000..0b91fabfa Binary files /dev/null and b/dropbox_integration/static/src/img/dropbox_icon.png differ diff --git a/dropbox_integration/static/src/img/file.png b/dropbox_integration/static/src/img/file.png new file mode 100644 index 000000000..08633e608 Binary files /dev/null and b/dropbox_integration/static/src/img/file.png differ diff --git a/dropbox_integration/static/src/js/dropbox.js b/dropbox_integration/static/src/js/dropbox.js new file mode 100644 index 000000000..c242fe019 --- /dev/null +++ b/dropbox_integration/static/src/js/dropbox.js @@ -0,0 +1,78 @@ +odoo.define('dropbox_integration.dashboard', function (require) { + 'use strict'; + var AbstractAction = require('web.AbstractAction'); + var core = require('web.core'); + var rpc = require('web.rpc'); + var DropboxDashboard = AbstractAction.extend({ + template: 'DropboxDashboard', + events: { + 'click #upload' : 'upload', + 'keyup .header-search-input' : 'search_file' + }, + + /* Appends files retrieved by function(import_files) to div files */ + init() { + this._super(...arguments); + var self = this; + rpc.query({ + model: 'dropbox.dashboard', + method: 'action_import_files', + args:[''] + }).then(function (result) { + 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 if(!result){ + self.do_action({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': 'Please setup Access Token', + 'type': 'warning', + 'sticky': false, + } + }) + } + else{ + self.$('#files').empty(); + var alt_src = "'dropbox_integration/static/src/img/file.png'" + $.each(Object.keys(result),function(index, name){ + self.$('#files').append(''); + }); + } + }); + }, + + /* Calls upload function on click of upload */ + upload: function (ev) { + this.do_action({ + name: "Upload to Dropbox", + type: 'ir.actions.act_window', + res_model: 'dropbox.upload', + view_mode: 'form', + view_type: 'form', + views: [[false, 'form']], + target: 'new', + }); + }, + + /* Search console function */ + search_file: function (ev) { + var value = this.$('.header-search-input').val().toLowerCase() + this.$('.card').filter(function () { + $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) + }); + }, + }); + core.action_registry.add("dropbox_dashboard", DropboxDashboard); + return DropboxDashboard; +}); diff --git a/dropbox_integration/static/src/scss/dropbox.scss b/dropbox_integration/static/src/scss/dropbox.scss new file mode 100644 index 000000000..8193f7479 --- /dev/null +++ b/dropbox_integration/static/src/scss/dropbox.scss @@ -0,0 +1,57 @@ +.drop_box_image{ + width: 180px; + height: 180px; + margin-top: 15px; +} + +.dropbox_upload{ + background-color: #006ce5; + color: white; + border-radius: 5px; + width: 100px; + margin-left: 10px; +} +.dropbox_card{ + margin-left: 20px; + background: linear-gradient(295deg, rgba(24,125,223,0.3897934173669467) 0%, rgba(47,145,217,0) 100%); + width: 20rem; + height:22rem; + border-radius: 1.25rem; + margin:15px; +} + +.dropbox_card:hover { + box-shadow: 0 4px 16px 0 rgba(0,0,0,1); +} + +.dropbox_text{ + color:black; +} +.content{ + margin-left: 3px; + overflow-y: scroll; + height: 850px; + width: auto; + background-color: #ffffff; + + } + +.file-icon{ + width: 65px; +} + +.dropbox_section{ +background: rgb(0,128,255); +background: radial-gradient(circle, rgba(0,128,255,1) 0%, rgba(0,82,255,0) 100%); +} + +.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: 380px; +} diff --git a/dropbox_integration/static/src/xml/dropbox_dashboard.xml b/dropbox_integration/static/src/xml/dropbox_dashboard.xml new file mode 100644 index 000000000..ed0353ffe --- /dev/null +++ b/dropbox_integration/static/src/xml/dropbox_dashboard.xml @@ -0,0 +1,15 @@ + + + diff --git a/dropbox_integration/views/dashboard_view.xml b/dropbox_integration/views/dashboard_view.xml new file mode 100644 index 000000000..c76b052bd --- /dev/null +++ b/dropbox_integration/views/dashboard_view.xml @@ -0,0 +1,14 @@ + + + + + Dropbox Dashboard + dropbox_dashboard + current + + + + diff --git a/dropbox_integration/views/res_config_settings_views.xml b/dropbox_integration/views/res_config_settings_views.xml new file mode 100644 index 000000000..f80e4a808 --- /dev/null +++ b/dropbox_integration/views/res_config_settings_views.xml @@ -0,0 +1,52 @@ + + + + + res.config.settings.view.form.inherit.dropbox.integration + res.config.settings + + + +
+
+ +
+
+
+
+ + Client ID: + + +
+
+ + Client Secret: + + +
+ +
+ + Folder ID: + + +
+
+
+
+
+
diff --git a/dropbox_integration/wizard/__init__.py b/dropbox_integration/wizard/__init__.py new file mode 100644 index 000000000..7a94235c0 --- /dev/null +++ b/dropbox_integration/wizard/__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 authentication_wizard +from . import dropbox_upload diff --git a/dropbox_integration/wizard/authentication_wizard.py b/dropbox_integration/wizard/authentication_wizard.py new file mode 100644 index 000000000..8b95b0bff --- /dev/null +++ b/dropbox_integration/wizard/authentication_wizard.py @@ -0,0 +1,49 @@ +# -*- 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 models, fields, api + + +class AuthenticationWizard(models.TransientModel): + """ + Generates auth code + """ + _name = 'authentication.wizard' + _description = 'Authentication Code Wizard' + + dropbox_authorization_code = fields.Char( + string='Dropbox Authorization Code', help='Dropbox Authorization Code') + dropbox_auth_url = fields.Char(string='Dropbox Authentication URL', + compute='_compute_dropbox_auth_url', + help='Dropbox Authentication URL') + + @api.depends('dropbox_authorization_code') + def _compute_dropbox_auth_url(self): + dbx_config = self.env['res.config.settings'].browse( + self.env.context.get('active_id')) + for rec in self: + rec.dropbox_auth_url = dbx_config.get_dropbox_auth_url() + + def action_setup_dropbox_token(self): + dbx_config = self.env['res.config.settings'].browse( + self.env.context.get('active_id')) + dbx_config.set_dropbox_refresh_token( + self.dropbox_authorization_code) diff --git a/dropbox_integration/wizard/authentication_wizard_views.xml b/dropbox_integration/wizard/authentication_wizard_views.xml new file mode 100644 index 000000000..587eb022e --- /dev/null +++ b/dropbox_integration/wizard/authentication_wizard_views.xml @@ -0,0 +1,35 @@ + + + + + authentication.wizard.form.dropbox.integration + authentication.wizard + +
+ + Get an authorization code and set it in the field + below. + + + + + + +
+
+
+
+
+
diff --git a/dropbox_integration/wizard/dropbox_upload.py b/dropbox_integration/wizard/dropbox_upload.py new file mode 100644 index 000000000..5a6bcdac6 --- /dev/null +++ b/dropbox_integration/wizard/dropbox_upload.py @@ -0,0 +1,73 @@ +# -*- 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 dropbox +from odoo import models, fields + +class DropboxUpload(models.TransientModel): + """ + For opening wizard view to upload files + """ + _name = "dropbox.upload" + + file = fields.Binary("Attachment", help="Select a file to upload") + file_name = fields.Char("File Name", help="File Name") + + def action_upload_file(self): + """ + upload files to dropbox + """ + try: + access = self.env['dropbox.dashboard'].search([], order='id desc', + limit=1) + dbx = dropbox.Dropbox(app_key=access.dropbox_client_id, + app_secret=access.dropbox_client_secret, + oauth2_refresh_token=access.dropbox_refresh_token) + attachment = self.env["ir.attachment"].search( + ['|', ('res_field', '!=', False), ('res_field', '=', False), + ('res_id', '=', self.id), + ('res_model', '=', 'dropbox.upload')]) + path = self.env['ir.config_parameter'].get_param( + 'dropbox_integration.folder_id') + dropbox_destination = path + '/' + self.file_name + file = open((attachment._full_path(attachment.store_fname)), 'rb') + dbx.files_upload(file.read(), dropbox_destination) + file.close() + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'success', + 'message': 'File has been uploaded successfully. ' + 'Please refresh.', + 'next': {'type': 'ir.actions.act_window_close'}, + } + } + except Exception as e: + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'warning', + 'message': 'Failed to upload: %s' % e, + 'next': {'type': 'ir.actions.act_window_close'}, + } + } diff --git a/dropbox_integration/wizard/dropbox_upload_views.xml b/dropbox_integration/wizard/dropbox_upload_views.xml new file mode 100644 index 000000000..5cb58eb3e --- /dev/null +++ b/dropbox_integration/wizard/dropbox_upload_views.xml @@ -0,0 +1,23 @@ + + + + + dropbox.upload.wizard.form.dropbox.integration + dropbox.upload + +
+ + + + + +
+
+
+