Browse Source

Aug 30: [FIX] Bug Fixed 'onedrive_integration_odoo'

pull/332/merge
Cybrosys Technologies 8 months ago
parent
commit
020a7c764a
  1. 7
      onedrive_integration_odoo/__manifest__.py
  2. 5
      onedrive_integration_odoo/doc/RELEASE_NOTES.md
  3. 13
      onedrive_integration_odoo/models/res_config_settings.py
  4. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/06.png
  5. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/2.png
  6. 2
      onedrive_integration_odoo/static/description/index.html
  7. 7
      onedrive_integration_odoo/views/res_config_settings_views.xml

7
onedrive_integration_odoo/__manifest__.py

@ -20,11 +20,12 @@
# #
############################################################################### ###############################################################################
{ {
'name': "OneDrive Integration", 'name': "Onedrive Integration",
'version': "16.0.1.0.0'", 'version': "16.0.1.0.0'",
'category': "Document Management", 'category': "Document Management",
'summary': """Sync Files between OneDrive and Odoo""", 'summary': """Upload and download files in Onedrive using odoo """,
'description': """Sync Files between OneDrive and Odoo""", 'description': """This module was developed to upload files to Onedrive as
well as access files from Onedrive in Odoo.""",
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions',

5
onedrive_integration_odoo/doc/RELEASE_NOTES.md

@ -3,3 +3,8 @@
#### Version 16.0.1.0.0 #### Version 16.0.1.0.0
#### ADD #### ADD
- Initial commit for Onedrive Integration - Initial commit for Onedrive Integration
#### 26.08.2024
#### Version 16.0.1.0.1
#### UPDT
- Added modules field and changed view

13
onedrive_integration_odoo/models/res_config_settings.py

@ -20,12 +20,15 @@
# #
############################################################################### ###############################################################################
import json import json
import logging
import requests import requests
from werkzeug import urls from werkzeug import urls
from odoo import fields, models, _ from odoo import fields, models, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
from odoo.http import request from odoo.http import request
_logger = logging.getLogger(__name__)
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
""" """
@ -47,6 +50,10 @@ class ResConfigSettings(models.TransientModel):
onedrive_access_token = fields.Char( onedrive_access_token = fields.Char(
string='Onedrive Access Token', string='Onedrive Access Token',
help="Access Token for authenticating with OneDrive API") help="Access Token for authenticating with OneDrive API")
onedrive_tenant_id = fields.Char(
string="Onedrive Tenant Id",
config_parameter='onedrive_integration_odoo.tenant_id',
help="Director (tenant) id for accessing OneDrive API")
onedrive_refresh_token = fields.Char( onedrive_refresh_token = fields.Char(
string='Onedrive Refresh Token', string='Onedrive Refresh Token',
help="Refresh Token for refreshing the access token") help="Refresh Token for refreshing the access token")
@ -72,12 +79,16 @@ class ResConfigSettings(models.TransientModel):
'redirect_uri': request.env['ir.config_parameter'].get_param( 'redirect_uri': request.env['ir.config_parameter'].get_param(
'web.base.url') + '/onedrive/authentication' 'web.base.url') + '/onedrive/authentication'
} }
tenant_id = self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.tenant_id', '')
res = requests.post( res = requests.post(
"https://login.microsoftonline.com/common/oauth2/v2.0/token", f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token",
data=data, data=data,
headers={"content-type": "application/x-www-form-urlencoded"}) headers={"content-type": "application/x-www-form-urlencoded"})
response = res.content and res.json() or {} response = res.content and res.json() or {}
if 'error' in response: if 'error' in response:
_logger.warning(response)
raise UserError(_("Error '%s': Please check the credentials.", raise UserError(_("Error '%s': Please check the credentials.",
response['error'])) response['error']))
else: else:

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 KiB

After

Width:  |  Height:  |  Size: 239 KiB

2
onedrive_integration_odoo/static/description/index.html

@ -205,7 +205,7 @@
<p style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;"> <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. Token setup is available in configuration settings. Setup Tokens button will redirect to an authorization page.
Goto --> Settngs-->Integrations</p> Goto --> Settngs-->Integrations</p>
<img src="assets/screenshots/6.png" class="img-thumbnail"> <img src="assets/screenshots/06.png" class="img-thumbnail">
</div> </div>
<div style="display: block; margin: 30px auto;"> <div style="display: block; margin: 30px auto;">

7
onedrive_integration_odoo/views/res_config_settings_views.xml

@ -32,6 +32,13 @@
attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}"/> attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}"/>
</span> </span>
</div> </div>
<div class="o_setting_right_pane">
<span invisible="'is_onedrive_enabled'== False">
Tenant Id:
<field name="onedrive_tenant_id"
invisible="'is_onedrive_enabled'== False"/>
</span>
</div>
<button class="o_setting_right_pane btn btn-link" <button class="o_setting_right_pane btn btn-link"
name="action_get_onedrive_auth_code" type="object" name="action_get_onedrive_auth_code" type="object"
attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}"> attrs="{'invisible': [('is_onedrive_enabled', '=', False)]}">

Loading…
Cancel
Save