diff --git a/odoo_owncloud_connector/README.rst b/odoo_owncloud_connector/README.rst new file mode 100644 index 000000000..574980cd4 --- /dev/null +++ b/odoo_owncloud_connector/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Odoo ownCloud Connector +======================= +This module help you to integrate ownCloud with odoo. We can upload,download and +delete the files to ownCloud. + +Configuration +============= +Enable the 'Owncloud Storage' in settings and add required credentials. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html ) + +Credits +------- +Developer: (V16) Saneen 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 `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/odoo_owncloud_connector/__init__.py b/odoo_owncloud_connector/__init__.py new file mode 100644 index 000000000..8dfa9abc7 --- /dev/null +++ b/odoo_owncloud_connector/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Saneen K (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 LESSER GENERAL PUBLIC LICENSE for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# along with this program. If not, see . +# +############################################################################### +from . import models +from . import wizard diff --git a/odoo_owncloud_connector/__manifest__.py b/odoo_owncloud_connector/__manifest__.py new file mode 100644 index 000000000..28f9faa43 --- /dev/null +++ b/odoo_owncloud_connector/__manifest__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Saneen K (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 LESSER GENERAL PUBLIC LICENSE for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# along with this program. If not, see . +# +############################################################################### +{ + 'name': "Odoo ownCloud Connector", + 'version': '16.0.1.0.0', + 'category': 'Document Management', + 'summary': 'ownCloud integration for document management', + 'description': 'We Can integrate ownCloud with odoo for managing the ' + 'documents. We can upload and download our documents using' + ' this module. Also we can delete the files from the' + ' ownCloud.', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['mail'], + 'data': [ + 'security/ir.model.access.csv', + 'views/owncloud_dashboard_views.xml', + 'views/res_config_settings_views.xml', + 'wizard/owncloud_upload_views.xml' + ], + 'assets': { + 'web.assets_backend': [ + '/odoo_owncloud_connector/static/src/js/owncloud.js', + '/odoo_owncloud_connector/static/src/xml/owncloud_dashboard_templates.xml', + '/odoo_owncloud_connector/static/src/scss/owncloud.scss' + ]}, + 'external_dependencies': {'python': ['pyocclient']}, + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/odoo_owncloud_connector/doc/RELEASE_NOTES.md b/odoo_owncloud_connector/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..03fbff627 --- /dev/null +++ b/odoo_owncloud_connector/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 01.03.2024 +#### Version 16.0.1.0.0 +#### ADD + +- Initial commit for Odoo ownCloud Connector diff --git a/odoo_owncloud_connector/models/__init__.py b/odoo_owncloud_connector/models/__init__.py new file mode 100644 index 000000000..35c31fae2 --- /dev/null +++ b/odoo_owncloud_connector/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Saneen K (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 LESSER GENERAL PUBLIC LICENSE for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# along with this program. If not, see . +# +############################################################################### +from . import owncloud_dashboard +from . import res_config_settings diff --git a/odoo_owncloud_connector/models/owncloud_dashboard.py b/odoo_owncloud_connector/models/owncloud_dashboard.py new file mode 100644 index 000000000..2b78a85b7 --- /dev/null +++ b/odoo_owncloud_connector/models/owncloud_dashboard.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Saneen K (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 LESSER GENERAL PUBLIC LICENSE for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# along with this program. If not, see . +# +############################################################################### +import os +import owncloud +from odoo import api, models + + +class OwnCloudDashboard(models.Model): + """OwnCloud Dashboard model viewing all the files from ownCloud""" + _name = 'owncloud.dashboard' + _description = 'Dashboard Model' + + @api.model + def action_owncloud_view_files(self): + """Import all files from ownCloud and show in dashboard""" + domain = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_domain') + user_name = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_user_name') + password = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_password') + folder = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_folder') + if not domain or not user_name or not password or not folder: + return ['e', "Please configure the credentials."] + try: + oc_access = owncloud.Client(domain) + oc_access.login(user_name, password) + file = [] + for file_name in [file.name for file in + oc_access.list('/' + folder)]: + link_info = oc_access.share_file_with_link( + '/' + folder + '/' + file_name) + file_info = oc_access.file_info('/' + folder + '/' + file_name) + size_bytes = round( + int(file_info.attributes['{DAV:}getcontentlength']) / 1024, + 1) + if size_bytes > 1024: + size = str(round(int(file_info.attributes[ + '{DAV:}getcontentlength']) / ( + 1024 * 1024), 1)) + ' MB' + else: + size = str(round(int(file_info.attributes[ + '{DAV:}getcontentlength']) / 1024, + 1)) + ' KB' + file.append( + [file_name, link_info.get_link(), str.upper( + os.path.splitext(file_name)[1].replace('.', '')), + size]) + oc_access.logout() + return file + except Exception as e: + return ['e', e] + + def action_delete_files(self, *args): + """Function for delete the file from dashboard and ownCloud storage""" + domain = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_domain') + user_name = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_user_name') + password = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_password') + folder = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_folder') + try: + oc_access = owncloud.Client(domain) + oc_access.login(user_name, password) + oc_access.delete('/' + folder + '/' + args[0]) + oc_access.logout() + return True + except Exception as e: + return ['e', e] diff --git a/odoo_owncloud_connector/models/res_config_settings.py b/odoo_owncloud_connector/models/res_config_settings.py new file mode 100644 index 000000000..f51a4aba3 --- /dev/null +++ b/odoo_owncloud_connector/models/res_config_settings.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Saneen K (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 LESSER GENERAL PUBLIC LICENSE for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# along with this program. If not, see . +# +############################################################################### +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + """ Configure the credentials in settings """ + _inherit = 'res.config.settings' + + owncloud_domain = fields.Char(string='Owncloud Domain', copy=False, + config_parameter='odoo_owncloud_' + 'connector.owncloud_domain', + help="Add the domain of your ownCloud") + owncloud_user_name = fields.Char(string='Owncloud Username', copy=False, + config_parameter='odoo_owncloud_' + 'connector.owncloud_' + 'user_name', + help="Add the username of your ownCloud") + owncloud_password = fields.Char(string='Owncloud Password', copy=False, + config_parameter='odoo_owncloud_' + 'connector.owncloud_' + 'password', + help="Add the password of your ownCloud") + owncloud_button = fields.Boolean(string='Owncloud Button', + config_parameter='odoo_owncloud_' + 'connector.owncloud_' + 'button', + help="Enables the ownCloud") + owncloud_folder = fields.Char(string='Owncloud Folder', copy=False, + config_parameter='odoo_owncloud_' + 'connector.owncloud_folder', + help="Give the exact folder name in the " + "ownCloud where the files are stored") diff --git a/odoo_owncloud_connector/security/ir.model.access.csv b/odoo_owncloud_connector/security/ir.model.access.csv new file mode 100644 index 000000000..2aa9463f5 --- /dev/null +++ b/odoo_owncloud_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_owncloud_dashboard_user,access.owncloud.dashboard.user,model_owncloud_dashboard,base.group_user,1,1,1,1 +access_owncloud_upload_user,access.owncloud.upload.user,model_owncloud_upload,base.group_user,1,1,1,1 diff --git a/odoo_owncloud_connector/static/description/assets/icons/check.png b/odoo_owncloud_connector/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/check.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/chevron.png b/odoo_owncloud_connector/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/chevron.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/cogs.png b/odoo_owncloud_connector/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/cogs.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/consultation.png b/odoo_owncloud_connector/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/consultation.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/ecom-black.png b/odoo_owncloud_connector/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/ecom-black.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/education-black.png b/odoo_owncloud_connector/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/education-black.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/hotel-black.png b/odoo_owncloud_connector/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/hotel-black.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/license.png b/odoo_owncloud_connector/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/license.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/lifebuoy.png b/odoo_owncloud_connector/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/lifebuoy.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/manufacturing-black.png b/odoo_owncloud_connector/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/manufacturing-black.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/pos-black.png b/odoo_owncloud_connector/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/pos-black.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/puzzle.png b/odoo_owncloud_connector/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/puzzle.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/restaurant-black.png b/odoo_owncloud_connector/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/restaurant-black.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/service-black.png b/odoo_owncloud_connector/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/service-black.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/trading-black.png b/odoo_owncloud_connector/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/trading-black.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/training.png b/odoo_owncloud_connector/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/training.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/update.png b/odoo_owncloud_connector/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/update.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/user.png b/odoo_owncloud_connector/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/user.png differ diff --git a/odoo_owncloud_connector/static/description/assets/icons/wrench.png b/odoo_owncloud_connector/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/icons/wrench.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/categories.png b/odoo_owncloud_connector/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/categories.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/check-box.png b/odoo_owncloud_connector/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/check-box.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/compass.png b/odoo_owncloud_connector/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/compass.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/corporate.png b/odoo_owncloud_connector/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/corporate.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/customer-support.png b/odoo_owncloud_connector/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/customer-support.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/cybrosys-logo.png b/odoo_owncloud_connector/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/cybrosys-logo.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/features.png b/odoo_owncloud_connector/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/features.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/logo.png b/odoo_owncloud_connector/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/logo.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/pictures.png b/odoo_owncloud_connector/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/pictures.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/pie-chart.png b/odoo_owncloud_connector/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/pie-chart.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/right-arrow.png b/odoo_owncloud_connector/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/right-arrow.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/star.png b/odoo_owncloud_connector/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/star.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/support.png b/odoo_owncloud_connector/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/support.png differ diff --git a/odoo_owncloud_connector/static/description/assets/misc/whatsapp.png b/odoo_owncloud_connector/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/misc/whatsapp.png differ diff --git a/odoo_owncloud_connector/static/description/assets/modules/1.jpg b/odoo_owncloud_connector/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..23c9017f7 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/modules/1.jpg differ diff --git a/odoo_owncloud_connector/static/description/assets/modules/2.gif b/odoo_owncloud_connector/static/description/assets/modules/2.gif new file mode 100644 index 000000000..beb106101 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/modules/2.gif differ diff --git a/odoo_owncloud_connector/static/description/assets/modules/3.jpg b/odoo_owncloud_connector/static/description/assets/modules/3.jpg new file mode 100644 index 000000000..455ecf7f0 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/modules/3.jpg differ diff --git a/odoo_owncloud_connector/static/description/assets/modules/4.png b/odoo_owncloud_connector/static/description/assets/modules/4.png new file mode 100644 index 000000000..96cc56e39 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/modules/4.png differ diff --git a/odoo_owncloud_connector/static/description/assets/modules/5.png b/odoo_owncloud_connector/static/description/assets/modules/5.png new file mode 100644 index 000000000..7f44b3cfd Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/modules/5.png differ diff --git a/odoo_owncloud_connector/static/description/assets/modules/6.jpg b/odoo_owncloud_connector/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..89b592097 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/modules/6.jpg differ diff --git a/odoo_owncloud_connector/static/description/assets/screenshots/1.png b/odoo_owncloud_connector/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..f9d83bc50 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/screenshots/1.png differ diff --git a/odoo_owncloud_connector/static/description/assets/screenshots/2.png b/odoo_owncloud_connector/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..587497191 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/screenshots/2.png differ diff --git a/odoo_owncloud_connector/static/description/assets/screenshots/3.png b/odoo_owncloud_connector/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..591b0c90b Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/screenshots/3.png differ diff --git a/odoo_owncloud_connector/static/description/assets/screenshots/4.png b/odoo_owncloud_connector/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..c53928684 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/screenshots/4.png differ diff --git a/odoo_owncloud_connector/static/description/assets/screenshots/5.png b/odoo_owncloud_connector/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..1f2e03e70 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/screenshots/5.png differ diff --git a/odoo_owncloud_connector/static/description/assets/screenshots/6.png b/odoo_owncloud_connector/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..e024da973 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/screenshots/6.png differ diff --git a/odoo_owncloud_connector/static/description/assets/screenshots/7.png b/odoo_owncloud_connector/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..d6df83f73 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/screenshots/7.png differ diff --git a/odoo_owncloud_connector/static/description/assets/screenshots/hero.gif b/odoo_owncloud_connector/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..6441ae641 Binary files /dev/null and b/odoo_owncloud_connector/static/description/assets/screenshots/hero.gif differ diff --git a/odoo_owncloud_connector/static/description/banner.png b/odoo_owncloud_connector/static/description/banner.png new file mode 100644 index 000000000..71a873394 Binary files /dev/null and b/odoo_owncloud_connector/static/description/banner.png differ diff --git a/odoo_owncloud_connector/static/description/icon.png b/odoo_owncloud_connector/static/description/icon.png new file mode 100644 index 000000000..905e54579 Binary files /dev/null and b/odoo_owncloud_connector/static/description/icon.png differ diff --git a/odoo_owncloud_connector/static/description/index.html b/odoo_owncloud_connector/static/description/index.html new file mode 100644 index 000000000..b8bedf9ac --- /dev/null +++ b/odoo_owncloud_connector/static/description/index.html @@ -0,0 +1,574 @@ +
+ +
+ +
+
+ Enterprise +
+
+ Community +
+
+
+ +
+
+
+ +

+ Odoo ownCloud Connector

+

Integrate ownCloud With Odoo For File Storage.

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

Explore This + Module

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ This module helps to integrate ownCloud with Odoo. By using this module we can upload the files to ownCloud storage. + Also, we can see all the file that are uploaded to the folder. We can also delete the unwanted files. + Here we have the options for search and filter the files. +
+
+ + + +
+
+ +
+

Features +

+
+
+
+
+ + Secure File Storage. +
+
+ + Upload the Files to ownCloud Storage. +
+
+ + Download the Files from ownCloud Storage. +
+
+ + Delete Files in the ownCloud Storage. +
+
+ + Available in Odoo 16.0 + Community and Enterprise. +
+
+
+ + + +
+
+ +
+

Screenshots +

+
+
+
+ +
+

Create a Folder in the ownCloud. +

+

Terminal -> pip install pyocclient.

+

For testing in demo account you can use the following URL :- https://demo.owncloud.org/login

+

Create a folder in ownCloud and copy the domain

+ +
+ +
+

Configure the Settings. +

+

After creating the folder in ownCloud go to General Settings in odoo. Under the Integration section + enables the 'ownCloud Storage' and add the all the required credentials.

+ +
+ +
+

Export the Files to the ownCloud. +

+

Go to 'ownCloud Storage' in menu. Click on the 'Export' button.

+ +
+ +
+

Browse for the File. +

+

On the wizard click on the 'UPLOAD YOUR FILE' for browse the file.

+ +
+ +
+

Upload the File. +

+

After browsing the required file, click on the 'UPLOAD' button.

+ +
+ +
+

File Uploaded. +

+

We can see the file is uploaded to the ownCloud storage successfully.

+ +
+ +
+

File Import. +

+

We can import all the files in the given folder. Also, we can download the file

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

Related + Products +

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

Our Services +

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

Our + Industries +

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

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

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

+ Mobile + friendly, + awe-inspiring product pages

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

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

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

+ An + all-inclusive + hotel management application

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

Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/odoo_owncloud_connector/static/src/img/OwnCloud-Logo.wine.svg b/odoo_owncloud_connector/static/src/img/OwnCloud-Logo.wine.svg new file mode 100644 index 000000000..8c3110abb --- /dev/null +++ b/odoo_owncloud_connector/static/src/img/OwnCloud-Logo.wine.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/odoo_owncloud_connector/static/src/js/owncloud.js b/odoo_owncloud_connector/static/src/js/owncloud.js new file mode 100644 index 000000000..d462fc552 --- /dev/null +++ b/odoo_owncloud_connector/static/src/js/owncloud.js @@ -0,0 +1,185 @@ +odoo.define('odoo_owncloud_connector.dashboard', function (require) { + 'use strict'; + var AbstractAction = require('web.AbstractAction'); + var core = require('web.core'); + var rpc = require('web.rpc'); + var Dialog = require('web.Dialog'); + var OwncloudDashboard = AbstractAction.extend({ + template: 'OwncloudDashboard', + events: { + 'click #owncloud_export' : 'export', + 'click #owncloud_import' : 'import', + 'click .delete_file': 'delete_file', + 'change #owncloud_filter' : 'filter_files', + 'keyup .owncloud_header-search-input' : 'search_file' + }, + /* Appends files retrieved by function(owncloud_view_files) to owncloud_table */ + init() { + this._super(...arguments); + var self = this; + self.import(); + }, + import: function(ev) { + var self = this; + rpc.query({ + model: 'owncloud.dashboard', + method: 'action_owncloud_view_files', + }).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 { + self.$el.find('.owncloud_files').empty(); + var count=1; + result.forEach((name, index) => { + self.$('.owncloud_files').append(''+count+''+name[0]+''+name[2]+''+name[3]+''); + count ++; + }); + } + }); + }, + /* Calls wizard action */ + export: function (ev) { + var self = this + rpc.query({ + model: 'owncloud.upload', + method: 'credentials_checking', + args:[,] + }).then(function (result) { + if (result == true){ + self.do_action({ + name: "Upload File", + type: 'ir.actions.act_window', + res_model: 'owncloud.upload', + view_mode: 'form', + view_type: 'form', + views: [[false, 'form']], + target: 'new', + }); + } else { + Dialog.alert(self, ("Please Configure the credentials.")); + } + }) + }, + /* Delete the file */ + delete_file: function (ev){ + var self = this + rpc.query({ + model: 'owncloud.dashboard', + method: 'action_delete_files', + args:['', ev.target.parentNode.getAttribute('value')] + }).then(function (result) { + if(result[0]=='e'){ + self.do_action({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': 'Failed to Delete File [ '+result[1]+' ]', + 'type': 'warning', + 'sticky': false, + } + }) + } else { + self.do_action({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'message': 'File deleted successfully', + 'type': 'success', + 'sticky': false, + } + }) + ev.target.parentNode.parentNode.remove() + self.sort(); + } + }); + }, + /* Sort the files */ + sort: function() { + var table = this.$el.find("#files_table"); + var tbody = table.find("tbody"); + var rows = tbody.find("tr"); + rows.sort(function(a, b) { + var slNoA = parseInt($(a).find("td:eq(0)").text()); + var slNoB = parseInt($(b).find("td:eq(0)").text()); + return slNoA - slNoB; + }); + var updated_rows = [] + for(var i=0;i -1) { + row.show(); + self.sort(); + } else { + row.hide(); + self.sort(); + } + }); + + } + }, + /* Filter on basis of file type */ + filter_files: function(ev){ + self = this + var filter = this.$el.find('#owncloud_filter')[0]; + this.$el.find('.file_row').each(function(index, name){ + self.$(this).hide(); + var file_name = self.$el.find('a')[index].innerText; + var file_type = file_name.slice((file_name.lastIndexOf(".") - 1 >>> 0) + 2); + if (filter.value=='ALL FILES'){ + self.$(this).show(); + } + else if (filter.value == file_type){ + self.$(this).show(); + } + else if(filter.value == 'image'){ + if (file_type=='jpeg' || file_type=='jpg' || file_type=='png'){ + self.$(this).show(); + } + } + else if(filter.value == 'txt'){ + if (file_type=='txt' || file_type=='docx'){ + self.$(this).show(); + } + } + }); + self.sort(); + }, + }); + core.action_registry.add("owncloud_dashboard", OwncloudDashboard); + return OwncloudDashboard; +}); diff --git a/odoo_owncloud_connector/static/src/scss/owncloud.scss b/odoo_owncloud_connector/static/src/scss/owncloud.scss new file mode 100644 index 000000000..87e1a1676 --- /dev/null +++ b/odoo_owncloud_connector/static/src/scss/owncloud.scss @@ -0,0 +1,48 @@ +.next-table{ + --table-bg: #007bc9; + color: white; +} +.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; + } +.owncloud_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: 30px; +} +.owncloud_export{ + background: #092f6e; + color: white; + height: 50px; + width: 120px; + border-radius: 6px; + float: right; + margin: 20px; + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5); +} +.owncloud_import{ + background: #092f6e; + color: white; + height: 50px; + width: 120px; + border-radius: 6px; + float: right; + margin: 20px; + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5); +} +.owncloud_content{ + overflow-y: scroll; + height: 100vh; + width: auto; + } diff --git a/odoo_owncloud_connector/static/src/xml/owncloud_dashboard_templates.xml b/odoo_owncloud_connector/static/src/xml/owncloud_dashboard_templates.xml new file mode 100644 index 000000000..7e2aea843 --- /dev/null +++ b/odoo_owncloud_connector/static/src/xml/owncloud_dashboard_templates.xml @@ -0,0 +1,48 @@ + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + +
SL NO: + NameTypeSize +
+
+
+
+
diff --git a/odoo_owncloud_connector/views/owncloud_dashboard_views.xml b/odoo_owncloud_connector/views/owncloud_dashboard_views.xml new file mode 100644 index 000000000..11b044b6f --- /dev/null +++ b/odoo_owncloud_connector/views/owncloud_dashboard_views.xml @@ -0,0 +1,11 @@ + + + + + Owncloud Storage + owncloud_dashboard + current + + + diff --git a/odoo_owncloud_connector/views/res_config_settings_views.xml b/odoo_owncloud_connector/views/res_config_settings_views.xml new file mode 100644 index 000000000..388750658 --- /dev/null +++ b/odoo_owncloud_connector/views/res_config_settings_views.xml @@ -0,0 +1,50 @@ + + + + + res.config.settings.view.form.inherit.odoo.owncloud.connector + res.config.settings + + + +
+
+ +
+
+
+
+ + ownCloud Domain: + + +
+
+ + ownCloud Username: + + +
+
+ + ownCloud Password: + + +
+
+ + ownCloud Folder: + + +
+
+
+
+
+
diff --git a/odoo_owncloud_connector/wizard/__init__.py b/odoo_owncloud_connector/wizard/__init__.py new file mode 100644 index 000000000..95f2bfbc1 --- /dev/null +++ b/odoo_owncloud_connector/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Saneen K (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 LESSER GENERAL PUBLIC LICENSE for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# along with this program. If not, see . +# +############################################################################## +from . import owncloud_upload diff --git a/odoo_owncloud_connector/wizard/owncloud_upload.py b/odoo_owncloud_connector/wizard/owncloud_upload.py new file mode 100644 index 000000000..92e2efb97 --- /dev/null +++ b/odoo_owncloud_connector/wizard/owncloud_upload.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Saneen K (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 LESSER GENERAL PUBLIC LICENSE for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# along with this program. If not, see . +# +############################################################################### +import owncloud +from odoo import fields, models, _ +from odoo.exceptions import UserError, ValidationError + + +class OwncloudUpload(models.TransientModel): + """ Wizard model for file upload in to ownCloud storage""" + _name = "owncloud.upload" + _description = 'Wizard for File Upload' + + 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_owncloud_upload_file(self): + """Function for upload the file in to Owncloud storage""" + attachment = self.env["ir.attachment"].search( + ['|', ('res_field', '!=', False), ('res_field', '=', False), + ('res_id', '=', self.id), + ('res_model', '=', 'owncloud.upload')]) + domain = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_domain') + user_name = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_user_name') + password = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_password') + folder = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_folder') + if not domain or not user_name or not password or not folder: + raise UserError(_('Please configure the credentials.')) + try: + oc_access = owncloud.Client(domain) + oc_access.login(user_name, password) + values = [] + for file in oc_access.list('/'): + if file.path[-1] == '/': + file.path = file.path[:-1] + values.append(file.path) + if '/' + folder in values: + oc_access.put_file('/' + folder + '/' + self.file_name, + attachment._full_path( + attachment.store_fname)) + oc_access.logout() + except Exception as e: + raise ValidationError(_( + 'Failed to Upload Files ( %s .)' % e)) + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'success', + 'message': "Your file uploaded successfully.", + 'next': {'type': 'ir.actions.act_window_close'}, + } + } + + def credentials_checking(self): + """Checking the credentials while uploading the file""" + domain = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_domain') + user_name = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_user_name') + password = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_password') + folder = self.env['ir.config_parameter'].get_param( + 'odoo_owncloud_connector.owncloud_folder') + try: + oc_access = owncloud.Client(domain) + oc_access.login(user_name, password) + values = [] + for file in oc_access.list('/'): + if file.path[-1] == '/': + file.path = file.path[:-1] + values.append(file.path) + if '/' + folder in values: + return True + except Exception: + return False diff --git a/odoo_owncloud_connector/wizard/owncloud_upload_views.xml b/odoo_owncloud_connector/wizard/owncloud_upload_views.xml new file mode 100644 index 000000000..708747332 --- /dev/null +++ b/odoo_owncloud_connector/wizard/owncloud_upload_views.xml @@ -0,0 +1,24 @@ + + + + + owncloud.upload.view.form + owncloud.upload + +
+ + + + + +
+
+
+