diff --git a/dropbox_integration/README.rst b/dropbox_integration/README.rst new file mode 100644 index 000000000..31d4fe4b4 --- /dev/null +++ b/dropbox_integration/README.rst @@ -0,0 +1,57 @@ +.. 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 + +Dropbox Integration +=================== +The Dropbox Integration provides seamless integration between Odoo instance and +Dropbox. With this module, you can access and manage your Dropbox files +directly from within Odoo. + +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. +Should install the python package dropbox by pip install dropbox + +Installation +============ +- www.odoo.com/documentation/15.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 +------- +* Developers: (V15) Aslam A K, Contact : odoo@cybrosys.com, + (V16) Aslam A K, Contact : odoo@cybrosys.com +* 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/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..5f8b8e505 --- /dev/null +++ b/dropbox_integration/__manifest__.py @@ -0,0 +1,57 @@ +# -*- 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': "15.0.1.0.0", + 'category': "Document Management", + 'summary': """Upload and Download Dropbox Files from Odoo""", + 'description': """This module was developed to upload files to Dropbox + storage as well as access files from Dropbox 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', + 'wizard/authentication_code_views.xml', + 'wizard/dropbox_upload_views.xml', + 'views/res_config_settings_views.xml', + 'views/dropbox_dashboard_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + '/dropbox_integration/static/src/js/dropbox.js', + '/dropbox_integration/static/src/scss/dropbox.scss' + ], + 'web.assets_qweb': [ + '/dropbox_integration/static/src/xml/dropbox_dashboard_templates.xml' + ], + }, + 'external_dependencies': {'python': ['dropbox']}, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': True, + '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..29bc35e16 --- /dev/null +++ b/dropbox_integration/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 29.09.2023 +#### Version 15.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..aa1909764 --- /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 api, SUPERUSER_ID + + +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.is_dropbox_integration')]).unlink() diff --git a/dropbox_integration/models/__init__.py b/dropbox_integration/models/__init__.py new file mode 100644 index 000000000..bfb0f3fa0 --- /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_dashboard +from . import res_config_settings diff --git a/dropbox_integration/models/dropbox_dashboard.py b/dropbox_integration/models/dropbox_dashboard.py new file mode 100644 index 000000000..23dfdb392 --- /dev/null +++ b/dropbox_integration/models/dropbox_dashboard.py @@ -0,0 +1,67 @@ +# -*- 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): + """ Dropbox dashboard model to connect with dropbox files.""" + _name = 'dropbox.dashboard' + _description = 'Dropbox Dashboard' + + dropbox_client = fields.Char(string='Dropbox Client ID', + help="Dropbox Client ID from dropbox api" + " credentials") + dropbox_client_secret = fields.Char(string='Dropbox Client Secret', + help="Dropbox Client Secret from" + " dropbox api credentials") + dropbox_refresh_token = fields.Char(string='Dropbox Refresh Token', + help="Dropbox Access Token generated " + "by dropbox api credentials") + dropbox_access_token = fields.Char(string='Dropbox Access Token', + help="Dropbox Refresh Token generated " + "by dropbox api credentials") + dropbox_expire_date = fields.Datetime(string='Dropbox Expiry Date', + help="Dropbox Access Token expiry" + "date") + + def action_import_files(self): + """ Import all files from dropbox folder """ + 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, + 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 error: + return ['error', error] diff --git a/dropbox_integration/models/res_config_settings.py b/dropbox_integration/models/res_config_settings.py new file mode 100644 index 000000000..f400fa595 --- /dev/null +++ b/dropbox_integration/models/res_config_settings.py @@ -0,0 +1,112 @@ +# -*- 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): + """ Model to configure the Dropbox api credentials.""" + _inherit = 'res.config.settings' + + dropbox_client = fields.Char(string='Dropbox Client ID', copy=False, + config_parameter='dropbox_integration.' + 'client_id', + help="Dropbox Client ID from dropbox api " + "credentials", + required=True) + dropbox_client_secret = fields.Char(string='Dropbox Client Secret', + copy=False, + config_parameter='dropbox_integration.' + 'client_secret', + help="Dropbox Client Secret from " + "dropbox api credentials", + required=True) + dropbox_access_token = fields.Char(string='Dropbox Access Token', + help="Dropbox Access Token generated by" + " dropbox api credentials") + dropbox_refresh_token = fields.Char(string='Dropbox Refresh Token', + help="Dropbox Refresh Token by dropbox" + " api credentials") + dropbox_token_validity = fields.Datetime(string='Dropbox Token Validity', + help="Dropbox Token expiry date") + dropbox_folder_id = fields.Char(string='Folder ID', + config_parameter='dropbox_integration.' + 'folder_id', + help="Dropbox Folder ID from where the " + "files to be imported and uploaded") + is_dropbox_integration = fields.Boolean(string='Dropbox Cloud Storage', + config_parameter= + 'dropbox_integration.' + 'is_dropbox_integration', + default=False, + help="Dropbox Integration " + "button to set " + "credentials") + + def action_get_dropbox_auth_code(self): + """ + Function to open a wizard to set up dropbox Authorization code + """ + return { + 'type': 'ir.actions.act_window', + 'name': 'Dropbox Authorization Code', + 'res_model': 'authentication.code', + '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': client_id, + 'dropbox_client_secret': client_secret, + 'dropbox_refresh_token': outh_result.refresh_token, + 'dropbox_access_token': outh_result.access_token, + }) + except Exception as error: + raise ValidationError( + _(f"Failed to Connect with Dropbox ( {error}.)'")) diff --git a/dropbox_integration/security/ir.model.access.csv b/dropbox_integration/security/ir.model.access.csv new file mode 100644 index 000000000..b8be5cf77 --- /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_code_user,access.authentication.code.user,model_authentication_code,base.group_user,1,1,1,1 +access_dropbox_upload_user,access.dropbox.upload,model_dropbox_upload,base.group_user,1,1,1,1 +access_dropbox_dashboard_user,access.dropbox.dashboard.user,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..591c8b18d 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..f5174ab22 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..a0969fcb5 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.gif b/dropbox_integration/static/description/assets/modules/4.gif new file mode 100644 index 000000000..c51b9eb07 Binary files /dev/null and b/dropbox_integration/static/description/assets/modules/4.gif 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..2eaebad5a 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..929f992f7 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..994a022c7 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..df880ac60 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..bd957d1dd 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..cd1e8b24e 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..ffa036ce0 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..45dc9b349 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..086b29ec3 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..a17fae34f 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..143f5f0cd 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..6688f5ba5 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..f3c8fc1ff Binary files /dev/null and b/dropbox_integration/static/description/assets/screenshots/hero.gif differ diff --git a/dropbox_integration/static/description/banner.jpg b/dropbox_integration/static/description/banner.jpg new file mode 100644 index 000000000..7e45c32b0 Binary files /dev/null and b/dropbox_integration/static/description/banner.jpg differ diff --git a/dropbox_integration/static/description/icon.png b/dropbox_integration/static/description/icon.png new file mode 100644 index 000000000..5d2b11ee6 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..7fbb5b4f6 --- /dev/null +++ b/dropbox_integration/static/description/index.html @@ -0,0 +1,722 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ 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 FolderId

+ +
+ +
+

+

+

+ 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..4b80a9b50 --- /dev/null +++ b/dropbox_integration/static/src/js/dropbox.js @@ -0,0 +1,76 @@ +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]=='error') + { + 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() + var cards = this.$('.card'); + Array.from(cards).forEach(function (card) { + card.style.display = card.textContent.toLowerCase().indexOf(value) > -1 ? 'block' : 'none'; + }); + }, + }); + 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..7bcc9b711 --- /dev/null +++ b/dropbox_integration/static/src/scss/dropbox.scss @@ -0,0 +1,50 @@ +.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%); + max-width:15%; + height:23rem; + 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: 85vh; + width: 100vw; + 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_templates.xml b/dropbox_integration/static/src/xml/dropbox_dashboard_templates.xml new file mode 100644 index 000000000..7bc3f75ca --- /dev/null +++ b/dropbox_integration/static/src/xml/dropbox_dashboard_templates.xml @@ -0,0 +1,17 @@ + + + diff --git a/dropbox_integration/views/dropbox_dashboard_views.xml b/dropbox_integration/views/dropbox_dashboard_views.xml new file mode 100644 index 000000000..89bb50781 --- /dev/null +++ b/dropbox_integration/views/dropbox_dashboard_views.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..91e7d89c1 --- /dev/null +++ b/dropbox_integration/views/res_config_settings_views.xml @@ -0,0 +1,54 @@ + + + + + + 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..d18819464 --- /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_code +from . import dropbox_upload diff --git a/dropbox_integration/wizard/authentication_code.py b/dropbox_integration/wizard/authentication_code.py new file mode 100644 index 000000000..84db077db --- /dev/null +++ b/dropbox_integration/wizard/authentication_code.py @@ -0,0 +1,58 @@ +# -*- 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, fields, models + + +class AuthenticationCode(models.TransientModel): + """ + Model to generate authentication code + """ + _name = 'authentication.code' + _description = 'Authentication Code' + + dropbox_authorization_code = fields.Char( + string='Dropbox Authorization Code', + help='Authorization code received from Dropbox during authentication ' + 'process') + dropbox_auth_url = fields.Char(string='Dropbox Authentication URL', + compute='_compute_dropbox_auth_url', + help='URL for initiating the Dropbox ' + 'authentication process') + + @api.depends('dropbox_authorization_code') + def _compute_dropbox_auth_url(self): + """ + Function to compute dropbox authentication URL + """ + 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): + """ + Function to setup new dropbox refresh token. + """ + 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_code_views.xml b/dropbox_integration/wizard/authentication_code_views.xml new file mode 100644 index 000000000..5070a3a54 --- /dev/null +++ b/dropbox_integration/wizard/authentication_code_views.xml @@ -0,0 +1,39 @@ + + + + + authentication.code.view.form + authentication.code + +
+ + + 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..07a707b31 --- /dev/null +++ b/dropbox_integration/wizard/dropbox_upload.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 dropbox +from odoo import fields, models + + +class DropboxUpload(models.TransientModel): + """ + Model to upload files to Dropbox + """ + _name = "dropbox.upload" + _description = "Dropbox Upload" + + file = fields.Binary(string="Attachment", help="Select a file to upload") + file_name = fields.Char(string="File Name", + help="Name of the uploaded file") + + def action_upload_file(self): + """ + Function to upload attachments to dropbox + """ + try: + access = self.env['dropbox.dashboard'].search([], order='id desc', + limit=1) + dbx = dropbox.Dropbox(app_key=access.dropbox_client, + 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 uploaded successfully. ' + 'Please refresh the page.', + 'next': {'type': 'ir.actions.act_window_close'}, + } + } + except Exception as error: + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'warning', + 'message': 'Failed to upload: %s' % error, + '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..f93df49a7 --- /dev/null +++ b/dropbox_integration/wizard/dropbox_upload_views.xml @@ -0,0 +1,27 @@ + + + + + dropbox.upload.view.form + dropbox.upload + +
+ + + + + + +
+
+
+