Browse Source

Feb 21 [ADD] : Initial Commit 'onedrive_integration_odoo'

pull/267/merge
AjmalCybro 1 year ago
parent
commit
1f50d687f4
  1. 51
      onedrive_integration_odoo/README.rst
  2. 25
      onedrive_integration_odoo/__init__.py
  3. 52
      onedrive_integration_odoo/__manifest__.py
  4. 22
      onedrive_integration_odoo/controllers/__init__.py
  5. 41
      onedrive_integration_odoo/controllers/onedrive_integration_odoo.py
  6. 5
      onedrive_integration_odoo/doc/RELEASE_NOTES.md
  7. 37
      onedrive_integration_odoo/hooks.py
  8. 23
      onedrive_integration_odoo/models/__init__.py
  9. 150
      onedrive_integration_odoo/models/onedrive_dashboard.py
  10. 108
      onedrive_integration_odoo/models/res_config_settings.py
  11. 3
      onedrive_integration_odoo/security/ir.model.access.csv
  12. BIN
      onedrive_integration_odoo/static/description/assets/icons/check.png
  13. BIN
      onedrive_integration_odoo/static/description/assets/icons/chevron.png
  14. BIN
      onedrive_integration_odoo/static/description/assets/icons/cogs.png
  15. BIN
      onedrive_integration_odoo/static/description/assets/icons/consultation.png
  16. BIN
      onedrive_integration_odoo/static/description/assets/icons/ecom-black.png
  17. BIN
      onedrive_integration_odoo/static/description/assets/icons/education-black.png
  18. BIN
      onedrive_integration_odoo/static/description/assets/icons/hotel-black.png
  19. BIN
      onedrive_integration_odoo/static/description/assets/icons/license.png
  20. BIN
      onedrive_integration_odoo/static/description/assets/icons/lifebuoy.png
  21. BIN
      onedrive_integration_odoo/static/description/assets/icons/manufacturing-black.png
  22. BIN
      onedrive_integration_odoo/static/description/assets/icons/pos-black.png
  23. BIN
      onedrive_integration_odoo/static/description/assets/icons/puzzle.png
  24. BIN
      onedrive_integration_odoo/static/description/assets/icons/restaurant-black.png
  25. BIN
      onedrive_integration_odoo/static/description/assets/icons/service-black.png
  26. BIN
      onedrive_integration_odoo/static/description/assets/icons/trading-black.png
  27. BIN
      onedrive_integration_odoo/static/description/assets/icons/training.png
  28. BIN
      onedrive_integration_odoo/static/description/assets/icons/update.png
  29. BIN
      onedrive_integration_odoo/static/description/assets/icons/user.png
  30. BIN
      onedrive_integration_odoo/static/description/assets/icons/wrench.png
  31. BIN
      onedrive_integration_odoo/static/description/assets/misc/categories.png
  32. BIN
      onedrive_integration_odoo/static/description/assets/misc/check-box.png
  33. BIN
      onedrive_integration_odoo/static/description/assets/misc/compass.png
  34. BIN
      onedrive_integration_odoo/static/description/assets/misc/corporate.png
  35. BIN
      onedrive_integration_odoo/static/description/assets/misc/customer-support.png
  36. BIN
      onedrive_integration_odoo/static/description/assets/misc/cybrosys-logo.png
  37. BIN
      onedrive_integration_odoo/static/description/assets/misc/features.png
  38. BIN
      onedrive_integration_odoo/static/description/assets/misc/logo.png
  39. BIN
      onedrive_integration_odoo/static/description/assets/misc/pictures.png
  40. BIN
      onedrive_integration_odoo/static/description/assets/misc/pie-chart.png
  41. BIN
      onedrive_integration_odoo/static/description/assets/misc/right-arrow.png
  42. BIN
      onedrive_integration_odoo/static/description/assets/misc/star.png
  43. BIN
      onedrive_integration_odoo/static/description/assets/misc/support.png
  44. BIN
      onedrive_integration_odoo/static/description/assets/misc/whatsapp.png
  45. BIN
      onedrive_integration_odoo/static/description/assets/modules/1.gif
  46. BIN
      onedrive_integration_odoo/static/description/assets/modules/2.png
  47. BIN
      onedrive_integration_odoo/static/description/assets/modules/3.png
  48. BIN
      onedrive_integration_odoo/static/description/assets/modules/4.png
  49. BIN
      onedrive_integration_odoo/static/description/assets/modules/5.png
  50. BIN
      onedrive_integration_odoo/static/description/assets/modules/6.png
  51. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/1.png
  52. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/10.png
  53. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/11.png
  54. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/12.png
  55. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/2.png
  56. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/3.png
  57. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/4.png
  58. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/5.png
  59. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/6.png
  60. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/7.png
  61. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/8.png
  62. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/9.png
  63. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/hero.gif
  64. BIN
      onedrive_integration_odoo/static/description/banner.png
  65. BIN
      onedrive_integration_odoo/static/description/icon.png
  66. 633
      onedrive_integration_odoo/static/description/index.html
  67. BIN
      onedrive_integration_odoo/static/src/img/excel.png
  68. BIN
      onedrive_integration_odoo/static/src/img/file.png
  69. BIN
      onedrive_integration_odoo/static/src/img/file_icon.png
  70. BIN
      onedrive_integration_odoo/static/src/img/image.png
  71. 1
      onedrive_integration_odoo/static/src/img/microsoft-onedrive.svg
  72. 1
      onedrive_integration_odoo/static/src/img/onedrive_name.svg
  73. BIN
      onedrive_integration_odoo/static/src/img/pdf.png
  74. 1
      onedrive_integration_odoo/static/src/img/sync.svg
  75. BIN
      onedrive_integration_odoo/static/src/img/txt.png
  76. BIN
      onedrive_integration_odoo/static/src/img/word.png
  77. BIN
      onedrive_integration_odoo/static/src/img/zip.png
  78. 124
      onedrive_integration_odoo/static/src/js/onedrive.js
  79. 44
      onedrive_integration_odoo/static/src/scss/onedrive.scss
  80. 59
      onedrive_integration_odoo/static/src/xml/onedrive_dashboard.xml
  81. 14
      onedrive_integration_odoo/views/onedrive_dashboard_views.xml
  82. 51
      onedrive_integration_odoo/views/res_config_settings_views.xml
  83. 22
      onedrive_integration_odoo/wizard/__init__.py
  84. 83
      onedrive_integration_odoo/wizard/upload_file.py
  85. 30
      onedrive_integration_odoo/wizard/upload_file_views.xml

51
onedrive_integration_odoo/README.rst

@ -0,0 +1,51 @@
.. 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
Onedrive Integration
====================
Onedrive Integration provides seamless integration with OneDrive, allowing users
to conveniently access their uploaded files from within the Odoo platform. With
this integration, users can easily view, upload and download files stored in
their OneDrive accounts, all from within their Odoo environment.
Configuration
=============
The user should create onedrive client id, client secret from microsoft azure
with scope 'offline_access, openid, Files.ReadWrite.All' to get access token.
Folder id is the id on onedrive folder url
License
-------
General Public License, Version 3 (AGPL v3).
(http://www.gnu.org/licenses/agpl-3.0-standalone.html)
Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
Credits
-------
* Developer: (v16) Aslam A K, Contact: odoo@cybrosys.com
Contacts
--------
* Mail Contact : odoo@cybrosys.com
* Website : https://cybrosys.com
Bug Tracker
-----------
Bugs are tracked on GitHub Issues. In case of trouble, please check there if
your issue has already been reported.
Maintainer
==========
.. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com
Further information
===================
HTML Description: `<static/description/index.html>`__

25
onedrive_integration_odoo/__init__.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import controllers
from . import models
from . import wizard
from .hooks import uninstall_hook

52
onedrive_integration_odoo/__manifest__.py

@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
{
'name': "OneDrive Integration",
'version': "16.0.1.0.0'",
'category': "Document Management",
'summary': """Sync Files between OneDrive and Odoo""",
'description': """Sync Files between OneDrive and 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/upload_file_views.xml',
'views/onedrive_dashboard_views.xml',
'views/res_config_settings_views.xml',
],
'assets': {
'web.assets_backend': [
'/onedrive_integration_odoo/static/src/js/onedrive.js',
'/onedrive_integration_odoo/static/src/scss/onedrive.scss',
'/onedrive_integration_odoo/static/src/xml/onedrive_dashboard.xml'
]
},
'images': ['static/description/banner.png'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': True,
'uninstall_hook': 'uninstall_hook',
}

22
onedrive_integration_odoo/controllers/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import onedrive_integration_odoo

41
onedrive_integration_odoo/controllers/onedrive_integration_odoo.py

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
import json
from odoo import http
from odoo.http import request
class OnedriveAuth(http.Controller):
"""
Return URL
"""
@http.route('/onedrive/authentication', type='http', auth="public")
def oauth2callback(self, **kw):
"""
Return URL
"""
state = json.loads(kw['state'])
onedrive_config_id = request.env['onedrive.dashboard'].sudo().browse(
state.get('onedrive_config_id'))
onedrive_config_id.get_tokens(kw.get('code'))
return request.redirect(state.get('url_return'))

5
onedrive_integration_odoo/doc/RELEASE_NOTES.md

@ -0,0 +1,5 @@
## Module <onedrive_integration_odoo>
#### 11.12.2023
#### Version 16.0.1.0.0
#### ADD
- Initial commit for Onedrive Integration

37
onedrive_integration_odoo/hooks.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
from odoo import SUPERUSER_ID, api
def uninstall_hook(cr, registry):
"""
Delete System Parameters
"""
env = api.Environment(cr, SUPERUSER_ID, {})
env['ir.config_parameter'].sudo().search(
[('key', '=', 'onedrive_integration_odoo.client_id')]).unlink()
env['ir.config_parameter'].sudo().search(
[('key', '=', 'onedrive_integration_odoo.client_secret')]).unlink()
env['ir.config_parameter'].sudo().search(
[('key', '=', 'onedrive_integration_odoo.folder_id')]).unlink()
env['ir.config_parameter'].sudo().search(
[('key', '=', 'onedrive_integration_odoo.onedrive_button')]).unlink()

23
onedrive_integration_odoo/models/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import onedrive_dashboard
from . import res_config_settings

150
onedrive_integration_odoo/models/onedrive_dashboard.py

@ -0,0 +1,150 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
import json
import logging
import requests
from datetime import timedelta
from odoo import fields, models
from odoo.http import request
_logger = logging.getLogger(__name__)
class OneDriveDashboard(models.Model):
"""
Generate refresh and access token
"""
_name = 'onedrive.dashboard'
_description = "Generate access and refresh tokens "
onedrive_access_token = fields.Char(
string="OneDrive Access Token",
store=True,
help="Access token for authenticating and accessing OneDrive APIs.")
onedrive_refresh_token = fields.Char(
string="OneDrive Refresh Token",
help="Refresh token for obtaining a new access token when the current "
"one expires.")
token_expiry_date = fields.Char(
string="OneDrive Token Validity",
help="Validity period of the access token, indicating until when it is"
" valid.")
upload_file = fields.Binary(
string="Upload File",
help="Binary field to store the uploaded file.")
def get_tokens(self, authorize_code):
"""
Generate onedrive tokens from authorization code
"""
data = {
'code': authorize_code,
'client_id': self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.client_id', ''),
'client_secret': self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.client_secret', ''),
'grant_type': 'authorization_code',
'scope': ['offline_access openid Files.ReadWrite.All'],
'redirect_uri': request.env['ir.config_parameter'].get_param(
'web.base.url') + '/onedrive/authentication'
}
try:
res = requests.post(
"https://login.microsoftonline.com/common/oauth2/v2.0/token",
data=data,
headers={"content-type": "application/x-www-form-urlencoded"})
res.raise_for_status()
response = res.content and res.json() or {}
if response:
expires_in = response.get('expires_in')
self.env['onedrive.dashboard'].create({
'onedrive_access_token': response.get('access_token'),
'onedrive_refresh_token': response.get('refresh_token'),
'token_expiry_date': fields.Datetime.now() + timedelta(
seconds=expires_in) if expires_in else False,
})
except requests.HTTPError as error:
_logger.exception("Bad microsoft onedrive request : %s !",
error.response.content)
raise error
def generate_onedrive_refresh_token(self):
"""
Generate onedrive access token from refresh token if expired
"""
data = {
'client_id': self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.client_id', ''),
'client_secret': self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.client_secret', ''),
'scope': ['offline_access openid Files.ReadWrite.All'],
'grant_type': "refresh_token",
'redirect_uri': request.env['ir.config_parameter'].get_param(
'web.base.url') + '/onedrive/authentication',
'refresh_token': self.onedrive_refresh_token
}
try:
res = requests.post(
"https://login.microsoftonline.com/common/oauth2/v2.0/token",
data=data,
headers={"Content-type": "application/x-www-form-urlencoded"})
res.raise_for_status()
response = res.content and res.json() or {}
if response:
expires_in = response.get('expires_in')
self.write({
'onedrive_access_token': response.get('access_token'),
'onedrive_refresh_token': response.get('refresh_token'),
'token_expiry_date': fields.Datetime.now() + timedelta(
seconds=expires_in) if expires_in else False,
})
except requests.HTTPError as error:
_logger.exception("Bad microsoft onedrive request : %s !",
error.response.content)
raise error
def action_synchronize_onedrive(self):
"""
Pass the files to javascript
"""
record = self.search([], order='id desc', limit=1)
if not record:
return False
if record.token_expiry_date <= str(fields.Datetime.now()):
record.generate_onedrive_refresh_token()
folder = self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.folder_id', '')
if not folder: return False
url = "https://graph.microsoft.com/v1.0/me/drive/items/%s/children" \
"?Content-Type=application/json" % folder
response = requests.request("GET", url, headers={
'Authorization': 'Bearer "' + record.onedrive_access_token + '"'},
data={})
message = json.loads(response.content)
if 'error' in message:
return ['error', message['error']['code'],
message['error']['message']]
files = {}
for file in response.json().get('value'):
if list(file.keys())[0] == '@microsoft.graph.downloadUrl':
files[file['name']] = file['@microsoft.graph.downloadUrl']
return files

108
onedrive_integration_odoo/models/res_config_settings.py

@ -0,0 +1,108 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
import json
import requests
from werkzeug import urls
from odoo import fields, models, _
from odoo.exceptions import UserError
from odoo.http import request
class ResConfigSettings(models.TransientModel):
"""
This model represents the configuration settings for the OneDrive
integration in Odoo.It allows users to configure various parameters for
OneDrive integration, including client ID, client secret, access token,
and folder ID.
"""
_inherit = 'res.config.settings'
onedrive_client = fields.Char(
string='Onedrive Client ID', copy=False,
config_parameter='onedrive_integration_odoo.client_id',
help="Client ID for accessing OneDrive API")
onedrive_client_secret = fields.Char(
string='Onedrive Client Secret',
config_parameter='onedrive_integration_odoo.client_secret',
help="Client Secret for accessing OneDrive API")
onedrive_access_token = fields.Char(
string='Onedrive Access Token',
help="Access Token for authenticating with OneDrive API")
onedrive_refresh_token = fields.Char(
string='Onedrive Refresh Token',
help="Refresh Token for refreshing the access token")
onedrive_folder = fields.Char(
string='Folder ID', help="ID of the folder in OneDrive",
config_parameter='onedrive_integration_odoo.folder_id')
is_onedrive_enabled = fields.Boolean(
string="Synchronize Onedrive with odoo",
config_parameter='onedrive_integration_odoo.onedrive_button',
help="Enable/Disable OneDrive integration")
def action_get_onedrive_auth_code(self):
"""
Generate onedrive authorization code
"""
data = {
'client_id': self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.client_id', ''),
'client_secret': self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.client_secret', ''),
'grant_type': 'client_credentials',
'scope': "https://graph.microsoft.com/.default",
'redirect_uri': request.env['ir.config_parameter'].get_param(
'web.base.url') + '/onedrive/authentication'
}
res = requests.post(
"https://login.microsoftonline.com/common/oauth2/v2.0/token",
data=data,
headers={"content-type": "application/x-www-form-urlencoded"})
response = res.content and res.json() or {}
if 'error' in response:
raise UserError(_("Error '%s': Please check the credentials.",
response['error']))
else:
authority = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
action = self.env["ir.actions.client"].sudo()._for_xml_id(
"onedrive_integration_odoo.onedrive_dashboard_action")
base_url = request.env['ir.config_parameter'].get_param(
'web.base.url')
url_return = base_url + '/web#id=%d&action=%d&view_type=form&model=%s' \
% (self.id, action['id'], 'onedrive.dashboard')
encoded_params = urls.url_encode({
'response_type': 'code',
'client_id': self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.client_id', ''),
'state': json.dumps({
'onedrive_config_id': self.id,
'url_return': url_return
}),
'scope': ['offline_access openid Files.ReadWrite.All'],
'redirect_uri': base_url + '/onedrive/authentication',
'prompt': 'consent',
'access_type': 'offline'
})
return {
'type': 'ir.actions.act_url',
'target': 'self',
'url': "%s?%s" % (authority, encoded_params),
}

3
onedrive_integration_odoo/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_onedrive_dashboard,access.onedrive.dashboard,model_onedrive_dashboard,base.group_user,1,1,1,1
access_upload_file,access.upload.file,model_upload_file,base.group_user,1,1,1,1
1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink
2 access_onedrive_dashboard access.onedrive.dashboard model_onedrive_dashboard base.group_user 1 1 1 1
3 access_upload_file access.upload.file model_upload_file base.group_user 1 1 1 1

BIN
onedrive_integration_odoo/static/description/assets/icons/check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
onedrive_integration_odoo/static/description/assets/icons/chevron.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

BIN
onedrive_integration_odoo/static/description/assets/icons/cogs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
onedrive_integration_odoo/static/description/assets/icons/consultation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
onedrive_integration_odoo/static/description/assets/icons/ecom-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
onedrive_integration_odoo/static/description/assets/icons/education-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
onedrive_integration_odoo/static/description/assets/icons/hotel-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

BIN
onedrive_integration_odoo/static/description/assets/icons/license.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
onedrive_integration_odoo/static/description/assets/icons/lifebuoy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
onedrive_integration_odoo/static/description/assets/icons/manufacturing-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

BIN
onedrive_integration_odoo/static/description/assets/icons/pos-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

BIN
onedrive_integration_odoo/static/description/assets/icons/puzzle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

BIN
onedrive_integration_odoo/static/description/assets/icons/restaurant-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
onedrive_integration_odoo/static/description/assets/icons/service-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

BIN
onedrive_integration_odoo/static/description/assets/icons/trading-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
onedrive_integration_odoo/static/description/assets/icons/training.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

BIN
onedrive_integration_odoo/static/description/assets/icons/update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
onedrive_integration_odoo/static/description/assets/icons/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

BIN
onedrive_integration_odoo/static/description/assets/icons/wrench.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/categories.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/check-box.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/compass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/corporate.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/customer-support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/cybrosys-logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/features.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

BIN
onedrive_integration_odoo/static/description/assets/misc/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/pictures.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/pie-chart.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/right-arrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

BIN
onedrive_integration_odoo/static/description/assets/misc/star.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
onedrive_integration_odoo/static/description/assets/misc/whatsapp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
onedrive_integration_odoo/static/description/assets/modules/1.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

BIN
onedrive_integration_odoo/static/description/assets/modules/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
onedrive_integration_odoo/static/description/assets/modules/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
onedrive_integration_odoo/static/description/assets/modules/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
onedrive_integration_odoo/static/description/assets/modules/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
onedrive_integration_odoo/static/description/assets/modules/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/12.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 KiB

BIN
onedrive_integration_odoo/static/description/assets/screenshots/hero.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 KiB

BIN
onedrive_integration_odoo/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
onedrive_integration_odoo/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

633
onedrive_integration_odoo/static/description/index.html

@ -0,0 +1,633 @@
<div style="background-color: #714B67; min-height: 600px; width: 100%; padding: 15px; position: relative;">
<!-- TITLE BAR -->
<div
style="border-bottom: 1px solid #875A7B; padding: 15px; display: flex; justify-content: space-between; align-items: center;">
<img src="/assets/misc/cybrosys-logo.png" width="42" height="42" style="width: 42px; height: 42px;" />
<div>
<div style="color: #7C7BAD; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;"
class="mr-2">
<i class="fa fa-check mr-1"></i>Community
</div>
<div style="color: #875A7B; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;"
class="mr-2">
<i class="fa fa-check mr-1"></i>Enterprise
</div>
<div style="color: #017E84; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;"
class="mr-2">
<i class="fa fa-check mr-1"></i>Odoo.sh
</div>
</div>
</div>
<!-- END OF TITLE BAR -->
<!-- APP HERO -->
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;">Onedrive Integration</h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">Onedrive Integration allows to upload and download the files in Microsoft OneDrive.
</p>
<!-- END OF APP HERO -->
<img src="assets/screenshots/hero.gif"
style="width: 75%; height: auto; position: absolute; margin-left: auto; margin-right: auto; top: 45%; left: 12%; right: auto;" />
</div>
<!-- NAVIGATION SECTION -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px; margin-top: 300px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="/assets/misc/compass.png" />
</div>
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Explore This
Module</h2>
</div>
<div class="row my-4" style="font-family: 'Montserrat', sans-serif;">
<div class="col-sm-12 col-md-6 my-3">
<a href="#overview">
<div class="d-flex justify-content-between align-items-center"
style="background-color: #f5f5f5; padding: 30px; width: 100%;">
<div>
<span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Overview</span>
<span
style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33; display: block;">Learn
more about this
module</span>
</div>
<img src="/assets/misc/right-arrow.png" width="36" height="36" />
</div>
</a>
</div>
<div class="col-sm-12 col-md-6 my-3">
<a href="#features">
<div class="d-flex justify-content-between align-items-center"
style="background-color: #f5f5f5; padding: 30px; width: 100%;">
<div>
<span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Features</span>
<span
style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33; display: block;">View
features of this
module</span>
</div>
<img src="/assets/misc/right-arrow.png" width="36" height="36" />
</div>
</a>
</div>
<div class="col-sm-12 col-md-6 my-3">
<a href="#screenshots">
<div class="d-flex justify-content-between align-items-center"
style="background-color: #f5f5f5; padding: 30px; width: 100%;">
<div>
<span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Screenshots</span>
<span
style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33; display: block;">View
screenshots for this
module</span>
</div>
<img src="/assets/misc/right-arrow.png" width="36" height="36" />
</div>
</a>
</div>
</div>
<!-- END OF NAVIGATION SECTION -->
<!-- OVERVIEW SECTION -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;" id="overview">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="/assets/misc/pie-chart.png" />
</div>
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Overview
</h2>
</div>
<div class="row" style="font-family: 'Montserrat', sans-serif; font-weight: 400; font-size: 14px; line-height: 200%;">
<div class="col-sm-12 py-4">
OneDrive is a cloud-based file storage and sharing service from Microsoft. Integrating OneDrive with Odoo can provide users with a more convenient way to store and access their files within the Odoo platform.
</div>
</div>
<!-- END OF OVERVIEW SECTION -->
<!-- FEATURES SECTION -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;" id="features">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/features.png" />
</div>
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Features
</h2>
</div>
<div class="row" style="font-family: 'Montserrat', sans-serif; font-weight: 400; font-size: 14px; line-height: 200%;">
<div class="col-sm-12 col-md-6">
<div class="d-flex align-items-center" style="margin-top: 40px; margin-bottom: 40px">
<img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Easy File Management</span>
</div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Displays all files on Onedrive</span>
</div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Upload files to Onedrive</span>
</div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Filter files on basis of file type</span>
</div>
</div>
</div>
<!-- END OF FEATURES SECTION -->
<!-- SCREENSHOTS SECTION -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;" id="screenshots">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/pictures.png" />
</div>
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Screenshots
</h2>
</div>
<div class="row">
<div class="col-sm-12">
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Onedrive api creation
</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
To create Onedrive api register application on Microsoft Azure </p>
<img src="assets/screenshots/1.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Onedrive client id
</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Registering on Microsoft Azure --> app registration will get client id and credentials </p>
<img src="assets/screenshots/2.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Onedrive client secret
</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Client secret is available on client credentials option. it will be shown only once so, need to save it somewhere safe.</p>
<img src="assets/screenshots/3.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Onedrive Scopes
</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Need to add scopes offline_access, openid, Files.ReadWrite.All to get refresh token and read write access</p>
<img src="assets/screenshots/4.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Onedrive Folder id
</h3>
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
The Onedrive folder id is presented on url of that folder itself.</p>
<img src="assets/screenshots/5.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Token setup
</h3>
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Token setup is available in configuration settings. Setup Tokens button will redirect to an authorization page.
Goto --> Settngs-->Integrations</p>
<img src="assets/screenshots/6.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
</h3>
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Login to microsoft to get auth code</p>
<img src="assets/screenshots/7.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
</h3>
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
</p>
<img src="assets/screenshots/8.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Onedrive Integration view</h3>
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
</p>
<img src="assets/screenshots/9.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Filter View</h3>
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Example for excel filter
</p>
<img src="assets/screenshots/10.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Filter View</h3>
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Example for ZIP filter
</p>
<img src="assets/screenshots/11.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Upload Files</h3>
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Wizard to upload files
</p>
<img src="assets/screenshots/12.png" class="img-thumbnail">
</div>
</div>
</div>
<!-- END OF SCREENSHOTS SECTION -->
<!-- RELATED PRODUCTS -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="/assets/misc/categories.png" />
</div>
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Related
Products
</h2>
</div>
<div class="row">
<div class="col-sm-12">
<div id="demo1" class="row carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner" style="padding: 30px;">
<div class="carousel-item" style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/auto_database_backup/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/1.gif">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/crm_dashboard/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/2.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/hr_zk_attendance/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/3.png">
</div>
</a>
</div>
</div>
<div class="carousel-item active" style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/inventory_stock_dashboard_odoo/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/4.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/odoo_chatgpt_connector/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/5.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/whatsapp_mail_messaging/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/6.png">
</div>
</a>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo1" data-slide="prev" style="width:35px; color:#000"> <span
class="carousel-control-prev-icon"><i class="fa fa-chevron-left" style="font-size:24px"></i></span>
</a> <a class="carousel-control-next" href="#demo1" data-slide="next" style="width:35px; color:#000">
<span class="carousel-control-next-icon"><i class="fa fa-chevron-right"
style="font-size:24px"></i></span>
</a>
</div>
</div>
</div>
<!-- END OF RELATED PRODUCTS -->
<!-- OUR SERVICES -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="/assets/misc/star.png" />
</div>
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Our Services
</h2>
</div>
<div class="container my-5">
<div class="row">
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #1dd1a1 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/cogs.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Customization</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/wrench.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/lifebuoy.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Support</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/user.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Hire
Odoo
Developer</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/puzzle.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Integration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/update.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Migration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/consultation.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Consultancy</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/training.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/license.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Licensing Consultancy</h6>
</div>
</div>
</div>
<!-- END OF OUR SERVICES -->
<!-- OUR INDUSTRIES -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="/assets/misc/corporate.png" />
</div>
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Our
Industries
</h2>
</div>
<div class="container my-5">
<div class="row">
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/trading-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Trading
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easily procure
and
sell your products</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/pos-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
POS
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easy
configuration
and convivial experience</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/education-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Education
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
A platform for
educational management</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/manufacturing-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Manufacturing
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Plan, track and
schedule your operations</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/ecom-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
E-commerce &amp; Website
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Mobile
friendly,
awe-inspiring product pages</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/service-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Service Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Keep track of
services and invoice</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/restaurant-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Restaurant
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Run your bar or
restaurant methodically</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/hotel-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Hotel Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
An
all-inclusive
hotel management application</p>
</div>
</div>
</div>
</div>
<!-- END OF OUR INDUSTRIES -->
<!-- SUPPORT -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="/assets/misc/customer-support.png" />
</div>
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Support
</h2>
</div>
<div class="container mt-5">
<div class="row">
<div class="col-sm-12 col-md-6">
<div style="background-color: #F6F8F9; padding: 30px; display: flex; align-items: center;">
<div class="mr-4"
style="background-color: #714B67; display: inline-block; height: 70px; width: 70px; display: flex; align-items: center; justify-content: center;">
<img src="/assets/misc/support.png" height="48" width="48" style="width: 42px; height: 42px;" />
</div>
<div>
<h4>Need Help?</h4>
<p style="line-height: 100%;">Got questions or need help? Get in touch.</p>
<a href="mailto:odoo@cybrosys.com">
<p style="font-weight: 400; font-size: 28px; line-height: 80%; color: #714B67;">
odoo@cybrosys.com</p>
</a>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div style="background-color: #F6F8F9; padding: 30px; display: flex; align-items: center;">
<div class="mr-4"
style="background-color: #2AC44D; display: inline-block; height: 70px; width: 70px; display: flex; align-items: center; justify-content: center;">
<img src="/assets/misc/whatsapp.png" height="52" width="52" style="width: 52px; height: 52px;" />
</div>
<div>
<h4>WhatsApp</h4>
<p style="line-height: 100%;">Say hi to us on WhatsApp!</p>
<a href="https://api.whatsapp.com/send?phone=918606827707">
<p style="font-weight: 400; font-size: 28px; line-height: 80%; color: #714B67;">+91 86068
27707</p>
</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 my-5 d-flex justify-content-center align-items-center">
<img src="/assets/misc/logo.png" width="144" height="31"
style="width:144px; height: 31px; margin-top: 40px;" />
</div>
</div>
</div>
<!-- END OF SUPPORT -->

BIN
onedrive_integration_odoo/static/src/img/excel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
onedrive_integration_odoo/static/src/img/file.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
onedrive_integration_odoo/static/src/img/file_icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
onedrive_integration_odoo/static/src/img/image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

1
onedrive_integration_odoo/static/src/img/microsoft-onedrive.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="microsoft-onedrive"><path fill="#0948AC" d="M16.54 10.649c-1.27-1.605-2.806-2.155-4.612-1.665-1.804.476-2.845 1.724-3.12 3.744-2.106.179-3.176 1.218-3.21 3.105-.036 1.88.998 2.958 3.102 3.232h12.738c1.612-.182 2.463-.999 2.555-2.448.093-1.447-.649-2.368-2.225-2.755l-.006-.02c0-.697-.166-1.338-.479-1.901a3.312 3.312 0 0 0-1.396-1.323c-.463-.253-1.029-.387-1.697-.432-.664-.043-1.214.107-1.65.463z"></path><path fill="#0948AC" d="M3.24 18.028a3.18 3.18 0 0 0 1.68-.453l.062.09c-.21-.505-.301-1.056-.301-1.65 0-.534.091-1.039.256-1.53a3.72 3.72 0 0 1 .75-1.293 3.514 3.514 0 0 1 1.289-.996 5.42 5.42 0 0 1 1.021-.311c.105-.52.3-1.011.585-1.471.285-.459.63-.862 1.05-1.218a5.217 5.217 0 0 1 1.62-.95c.6-.224 1.23-.327 1.89-.327.721 0 1.396.118 2.011.386a4.941 4.941 0 0 1 1.664 1.158c.361-.133.765-.192 1.23-.192h.285c-.24-1.233-.826-2.229-1.756-3.002-.929-.772-2.023-1.174-3.314-1.204-.959.016-1.83.254-2.609.714a5.624 5.624 0 0 0-1.861 1.843c-.57-.342-1.215-.505-1.934-.505-1.142.03-2.088.416-2.842 1.144-.75.728-1.14 1.663-1.17 2.792 0 .197.012.384.042.561-.833.101-1.518.445-2.058 1.04-.539.593-.814 1.318-.83 2.172.031.906.346 1.665.953 2.26.607.6 1.367.914 2.287.942z"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

1
onedrive_integration_odoo/static/src/img/onedrive_name.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="2500" height="458" viewBox="9.834 24.936 729.053 133.682" id="onedrive"><path fill="#094ab1" d="M68.896 158.617c-17.87 0-32.183-5.889-42.935-17.666s-16.128-27.1-16.128-45.967c0-20.273 5.48-36.445 16.436-48.516s25.87-18.105 44.736-18.105c17.401 0 31.42 5.859 42.056 17.578 10.634 11.719 15.951 27.041 15.952 45.967 0 20.566-5.45 36.826-16.348 48.779-10.899 11.954-25.489 17.93-43.769 17.93zm1.055-116.894c-13.242 0-23.994 4.775-32.256 14.326s-12.393 22.09-12.393 37.617 4.028 28.022 12.085 37.485 18.56 14.194 31.51 14.194c13.827 0 24.725-4.512 32.694-13.535 7.968-9.023 11.952-21.65 11.953-37.881 0-16.641-3.868-29.502-11.602-38.584-7.735-9.081-18.399-13.622-31.99-13.622zM226.572 156.508h-14.414V105.18c0-19.102-6.973-28.652-20.918-28.652-7.207 0-13.169 2.71-17.886 8.13s-7.075 12.261-7.075 20.522v51.328h-14.414v-90h14.414v14.941h.352c6.797-11.367 16.641-17.051 29.531-17.051 9.844 0 17.373 3.179 22.588 9.536 5.214 6.357 7.821 15.542 7.822 27.554v55.02zM326.152 115.112h-63.545c.234 10.02 2.93 17.754 8.086 23.203s12.246 8.174 21.27 8.174c10.137 0 19.453-3.34 27.95-10.02v13.535c-7.91 5.742-18.37 8.613-31.378 8.613-12.715 0-22.705-4.087-29.97-12.261s-10.899-19.673-10.899-34.497c0-14.004 3.97-25.415 11.91-34.233s17.797-13.228 29.574-13.228 20.89 3.809 27.334 11.426 9.667 18.193 9.668 31.729v7.559zm-14.766-12.217c-.06-8.32-2.065-14.795-6.02-19.424s-9.449-6.943-16.48-6.943c-6.797 0-12.568 2.432-17.314 7.295s-7.676 11.221-8.789 19.072h48.603zM349.97 156.508V30.473h34.805c44.414 0 66.621 20.479 66.621 61.436 0 19.453-6.167 35.083-18.5 46.89-12.336 11.807-28.845 17.71-49.527 17.71H349.97zm14.766-112.676v99.316h18.81c16.522 0 29.384-4.424 38.583-13.271s13.8-21.387 13.8-37.617c0-32.285-17.169-48.428-51.505-48.428h-19.688zM521.181 81.098c-2.52-1.934-6.152-2.9-10.898-2.9-6.152 0-11.294 2.9-15.425 8.701s-6.196 13.711-6.196 23.73v45.879h-14.414v-90h14.414v18.545h.352c2.051-6.328 5.186-11.265 9.404-14.81s8.936-5.317 14.15-5.317c3.75 0 6.621.41 8.613 1.23v14.942zM544.208 43.657c-2.578 0-4.775-.879-6.592-2.637s-2.725-3.984-2.725-6.68.908-4.937 2.725-6.724 4.014-2.681 6.592-2.681c2.637 0 4.878.894 6.724 2.681s2.77 4.028 2.77 6.724c0 2.578-.924 4.775-2.77 6.592s-4.087 2.725-6.724 2.725zm7.032 112.851h-14.414v-90h14.414v90zM651.171 66.508l-35.859 90h-14.15l-34.102-90h15.82l22.852 65.391c1.7 4.805 2.754 8.994 3.164 12.568h.352c.586-4.512 1.523-8.584 2.812-12.217l23.906-65.742h15.205zM738.886 115.112h-63.545c.234 10.02 2.93 17.754 8.086 23.203s12.246 8.174 21.27 8.174c10.137 0 19.453-3.34 27.95-10.02v13.535c-7.91 5.742-18.37 8.613-31.378 8.613-12.715 0-22.705-4.087-29.97-12.261S660.4 126.683 660.4 111.859c0-14.004 3.97-25.415 11.91-34.233s17.797-13.228 29.574-13.228 20.89 3.809 27.334 11.426 9.668 18.193 9.668 31.729v7.559zm-14.766-12.217c-.059-8.32-2.065-14.795-6.02-19.424s-9.449-6.943-16.48-6.943c-6.797 0-12.568 2.432-17.314 7.295s-7.676 11.221-8.789 19.072h48.603z"></path></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
onedrive_integration_odoo/static/src/img/pdf.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

1
onedrive_integration_odoo/static/src/img/sync.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="40" viewBox="0 96 960 960" width="40"><path d="M166.667 912.667v-79h95.667L258.001 829Q197 774.334 168 712.667q-29-61.667-29-134 0-121 77-214t196.333-120.333v107.332q-75 21-121.5 84.834-46.5 63.833-46.5 142.167 0 52.333 19.833 93.667 19.834 41.333 55.834 74l16.667 10.667v-94.334h79v250h-249Zm381.667-4.334V800.334q75.666-21 121.5-84.834 45.833-63.833 45.833-142.167 0-42.333-20.167-85.667Q675.334 444.333 642 409l-16-14.001v94.334h-79.666v-250H796v79h-97.001l5 6q58.667 56.333 87.834 121.5T821 573.333q0 121-76.667 214.333Q667.667 881 548.334 908.333Z"/></svg>

After

Width:  |  Height:  |  Size: 609 B

BIN
onedrive_integration_odoo/static/src/img/txt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
onedrive_integration_odoo/static/src/img/word.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
onedrive_integration_odoo/static/src/img/zip.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

124
onedrive_integration_odoo/static/src/js/onedrive.js

@ -0,0 +1,124 @@
odoo.define('onedrive_integration_odoo.dashboard', function (require) {
'use strict';
var AbstractAction = require('web.AbstractAction');
var core = require('web.core');
var rpc = require('web.rpc');
var OnedriveDashboard = AbstractAction.extend({
template: 'OnedriveDashboard',
events: {
'click #import': 'synchronize',
'click #upload': 'upload',
'click .file-type': 'filter_file_type'
},
init() {
this._super(...arguments);
var self = this;
self.synchronize();
},
/**
* Opens a file upload dialog on click of the "Upload" button.
*
* @param {Object} ev - The click event object.
*/
upload: function (ev) {
this.do_action({
name: "Upload File",
type: 'ir.actions.act_window',
res_model: 'upload.file',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new',
});
},
/**
* Retrieves and displays files from OneDrive on click of the "Import" button.
*
* @param {Object} ev - The click event object.
*/
synchronize: function (ev) {
var self = this;
rpc.query({
model: 'onedrive.dashboard',
method: 'action_synchronize_onedrive',
args: ['']
}).then(function (result) {
if (!result) {
// Display a notification if access tokens are not set up
self.do_action({
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'message': 'Please setup credentials',
'type': 'warning',
'sticky': false,
}
});
} else if (result[0] === 'error') {
console.log(result);
if (result[1] === 'itemNotFound') {
// Display a notification if the folder is not found
self.do_action({
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'message': 'Error: Folder not found.',
'type': 'warning',
'sticky': false,
}
});
} else {
// Display a notification for other errors
self.do_action({
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'message': 'Error:' + result[2],
'type': 'warning',
'sticky': false,
}
});
}
} else {
// Empty the onedrive_files div and append the files retrieved
self.$('#onedrive_files').empty();
var alt_src = "'/onedrive_integration_odoo/static/src/img/file_icon.png'";
$.each(Object.keys(result), function (index, name) {
self.$('#onedrive_files').append('<div class="col-sm-6 card" align="center"><a href="' + result[name] + '"><img class="card-img top" src="' + result[name] + '" onerror="this.src=' + alt_src + ';"/>' + name + '</div>');
});
}
});
},
/**
* Filters files displayed based on file type (e.g., image, all files).
*
* @param {Object} ev - The click event object.
*/
filter_file_type: function (ev) {
var value = ev.currentTarget.getAttribute('value');
$.each(this.$('.card'), function (index, name) {
$(this).hide();
var file_type = (name.textContent).slice(((name.textContent).lastIndexOf(".") - 1 >>> 0) + 2);
if (file_type == value) {
$(this).show();
}
if (value == 'allfiles') {
$(this).show();
}
if (value == 'image') {
if (file_type == 'jpeg' || file_type == 'jpg' || file_type == 'png') {
$(this).show();
}
}
});
},
});
core.action_registry.add("onedrive_dashboard", OnedriveDashboard);
return OnedriveDashboard;
});

44
onedrive_integration_odoo/static/src/scss/onedrive.scss

@ -0,0 +1,44 @@
.left-sidebar {
background-color: #0529ac;
color: white;
border-radius: 5px;
width: 110px;
}
.files{
margin-top: 20px;
}
.file-icon{
width: 65px;
margin-top: 42px;
margin-left: 5px;
}
.image{
opacity: 80%;
width: 55px;
margin-left: 10px;
}
.card-img-top{
width: 180px;
height: 180px;
}
.import{
background-color: #ffffff;
color: #0529ac;
border-radius: 5px;
width: 100px;
border-color: unset;
margin-left: 10px
}
.upload{
background-color: #0529ac;
color: white;
border-radius: 5px;
width: 100px;
margin-left: 10px;
}
.card{
max-width: 15%;
height: 23rem;
border-radius: 1.25rem;
margin: 15px;
}

59
onedrive_integration_odoo/static/src/xml/onedrive_dashboard.xml

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Dashboard template -->
<template id="onedrive">
<t t-name="OnedriveDashboard">
<section class="dashboard_main_section" id="main_section_manager">
<!-- OneDrive logo -->
<img src="/onedrive_integration_odoo/static/src/img/microsoft-onedrive.svg"
style="width:100px; margin-left: 10px;"/>
<img src="/onedrive_integration_odoo/static/src/img/onedrive_name.svg"
style="width:150px; margin-left: 15px;"/>
<!-- Import button -->
<input class="btn import" type="button" value="Import"
id="import"/>
<!-- Upload button -->
<input class="btn upload" type="button" value="Upload"
id="upload"/>
<div class="row">
<div class="left-sidebar">
<div class="files">
<!-- File type: all files -->
<div class="file-type" value="allfiles">
<img class="file-icon"
src="onedrive_integration_odoo/static/src/img/file.png"/>
</div>
<!-- File type: image -->
<div class="file-type" value="image">
<img class="file-icon image"
src="onedrive_integration_odoo/static/src/img/image.png"/>
</div>
<!-- File type: PDF -->
<div class="file-type" value="pdf">
<img class="file-icon"
src="onedrive_integration_odoo/static/src/img/pdf.png"/>
</div>
<!-- File type: Excel -->
<div class="file-type" value="xlsx">
<img class="file-icon"
src="onedrive_integration_odoo/static/src/img/excel.png"/>
</div>
<!-- File type: ZIP -->
<div class="file-type" value="zip">
<img class="file-icon"
src="onedrive_integration_odoo/static/src/img/zip.png"/>
</div>
<!-- File type: Text -->
<div class="file-type" value="txt">
<img class="file-icon"
src="onedrive_integration_odoo/static/src/img/txt.png"/>
</div>
</div>
</div>
<!-- Content area to display OneDrive files -->
<div class="col row content"
style="overflow-y: scroll; height: 80vh; background-color:lightgray;"
id="onedrive_files"/>
</div>
</section>
</t>
</template>

14
onedrive_integration_odoo/views/onedrive_dashboard_views.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- The client action for OneDrive Dashboard -->
<record id="onedrive_dashboard_action" model="ir.actions.client">
<field name="name">OneDrive Dashboard</field>
<field name="tag">onedrive_dashboard</field>
<field name="target">current</field>
</record>
<!-- A menu item for OneDrive Dashboard -->
<menuitem id="onedrive_dashboard_menu_root"
name="OneDrive Dashboard"
web_icon="onedrive_integration_odoo,static/description/icon.png"
action="onedrive_dashboard_action"/>
</odoo>

51
onedrive_integration_odoo/views/res_config_settings_views.xml

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Defines the SetupToken view for settings -->
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.inherit.view.onedrive.integration.odoo</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='integration']" position="inside">
<!-- OneDrive settings -->
<div class="col-12 col-lg-6 o_setting_box" id="onedrive">
<div class="o_setting_left_pane">
<field name="is_onedrive_enabled" string="Microsoft OneDrive"/>
</div>
<div class="o_setting_right_pane">
<label for="is_onedrive_enabled"/>
<div class="text-muted">
Synchronize with OneDrive
</div>
</div>
<div class="o_setting_right_pane">
<span attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}">
Client ID:
<field name="onedrive_client"
attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}"/>
</span>
</div>
<div class="o_setting_right_pane">
<span attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}">
Client Secret:
<field name="onedrive_client_secret" password="True"
attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}"/>
</span>
</div>
<button class="o_setting_right_pane btn btn-link"
name="action_get_onedrive_auth_code" type="object"
attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}">
<i class="fa fa-arrow-right"/>Setup Token
</button>
<div class="o_setting_right_pane">
<span attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}">
Folder ID:
<field name="onedrive_folder"
attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}"/>
</span>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

22
onedrive_integration_odoo/wizard/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import upload_file

83
onedrive_integration_odoo/wizard/upload_file.py

@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
import requests
from odoo import exceptions, fields, models, _
class UploadFile(models.TransientModel):
"""
For opening wizard view
"""
_name = "upload.file"
_description = "Upload File"
file = fields.Binary(string="Attachment", help="Select a file to upload")
file_name = fields.Char(string="File Name", help="Name of the attachment")
def action_upload_file(self):
"""
Upload file to onedrive
"""
if not self.file:
raise exceptions.UserError(_('Please Attach a file to upload.'))
attachment = self.env["ir.attachment"].search(
['|', ('res_field', '!=', False), ('res_field', '=', False),
('res_id', '=', self.id),
('res_model', '=', 'upload.file')])
token = self.env['onedrive.dashboard'].search([], order='id desc',
limit=1)
folder = self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.folder_id', '')
if not token or not folder:
raise exceptions.UserError(
_('Please setup Access Token and Folder Id.'))
if token.token_expiry_date <= str(fields.Datetime.now()):
token.generate_onedrive_refresh_token()
try:
url = "http://graph.microsoft.com/v1.0/me/drive/items/%s:/%s:/" \
"createUploadSession" % (folder, self.file_name)
upload_session = requests.post(url, headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer "' + token.onedrive_access_token + '"'
})
requests.put(upload_session.json().get('uploadUrl'), data=open(
(attachment._full_path(attachment.store_fname)), 'rb'))
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'type': 'success',
'message': 'File has been uploaded successfully. '
'Please refresh.',
'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'},
}
}

30
onedrive_integration_odoo/wizard/upload_file_views.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Upload file wizard view -->
<record id="upload_file_view_form" model="ir.ui.view">
<field name="name">upload.file.view.form</field>
<field name="model">upload.file</field>
<field name="arch" type="xml">
<form string="upload file wizard">
<group class="oe_title">
<field name="file" string="" filename="file_name"/>
<field name="file_name" invisible="1"/>
</group>
<footer>
<button string="Upload" name="action_upload_file" type="object"
class="oe_highlight" data-hotkey="q" help="Confirm Upload"/>
<button string="Cancel" class="btn btn-secondary"
special="cancel" help="Cancel Upload"/>
</footer>
</form>
</field>
</record>
<record id="upload_file_action" model="ir.actions.act_window">
<field name="name">Select a File</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">upload.file</field>
<field name="view_mode">form</field>
<field name="view_id" ref="upload_file_view_form"/>
<field name="target">new</field>
</record>
</odoo>
Loading…
Cancel
Save