Browse Source

Aug 16: [FIX] Bug Fixed 'onedrive_integration_odoo'

pull/331/head
Cybrosys Technologies 8 months ago
parent
commit
76c90358df
  1. 2
      onedrive_integration_odoo/__manifest__.py
  2. 1
      onedrive_integration_odoo/controllers/onedrive_integration_odoo.py
  3. 5
      onedrive_integration_odoo/doc/RELEASE_NOTES.md
  4. 10
      onedrive_integration_odoo/models/res_config_settings.py
  5. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/mic2.png
  6. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/mic_2_1.png
  7. 2
      onedrive_integration_odoo/static/description/index.html
  8. 10
      onedrive_integration_odoo/views/res_config_settings_views.xml

2
onedrive_integration_odoo/__manifest__.py

@ -21,7 +21,7 @@
############################################################################### ###############################################################################
{ {
'name': "Onedrive Integration", 'name': "Onedrive Integration",
'version': "17.0.1.0.0", 'version': "17.0.1.0.1",
'category': "Productivity", 'category': "Productivity",
'summary': """Upload and download files in Onedrive using odoo """, 'summary': """Upload and download files in Onedrive using odoo """,
'description': """This module was developed to upload files to Onedrive as 'description': """This module was developed to upload files to Onedrive as

1
onedrive_integration_odoo/controllers/onedrive_integration_odoo.py

@ -42,3 +42,4 @@ class OnedriveAuth(http.Controller):
state.get('onedrive_config_id')) state.get('onedrive_config_id'))
onedrive_config_id.get_tokens(kw.get('code')) onedrive_config_id.get_tokens(kw.get('code'))
return request.redirect(state.get('url_return')) return request.redirect(state.get('url_return'))

5
onedrive_integration_odoo/doc/RELEASE_NOTES.md

@ -3,3 +3,8 @@
#### Version 17.0.1.0.0 #### Version 17.0.1.0.0
#### ADD #### ADD
- Initial commit for Onedrive Integration - Initial commit for Onedrive Integration
#### 16.08.2024
#### Version 17.0.1.0.1
#### UPDT
- Added modules field and changed view

10
onedrive_integration_odoo/models/res_config_settings.py

@ -20,8 +20,10 @@
# #
############################################################################### ###############################################################################
import json import json
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
@ -44,6 +46,10 @@ class ResConfigSettings(models.TransientModel):
string='Onedrive Client Secret', string='Onedrive Client Secret',
config_parameter='onedrive_integration_odoo.client_secret', config_parameter='onedrive_integration_odoo.client_secret',
help="Client Secret for accessing OneDrive API") help="Client Secret for accessing 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_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")
@ -72,8 +78,10 @@ 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 {}

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 KiB

After

Width:  |  Height:  |  Size: 202 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

2
onedrive_integration_odoo/static/description/index.html

@ -297,7 +297,7 @@
style="padding: 1rem 4rem !important;"> style="padding: 1rem 4rem !important;">
<div style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> <div style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0"> <div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/mic7.png" <img src="assets/screenshots/mic_2_1.png"
class="img-thumbnail" width="100%" class="img-thumbnail" width="100%"
height="auto"> height="auto">
</div> </div>

10
onedrive_integration_odoo/views/res_config_settings_views.xml

@ -26,12 +26,18 @@
/> />
</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>
<div class="o_setting_right_pane"> <div class="o_setting_right_pane">
<span invisible="'is_onedrive_enabled'== False"> <span invisible="'is_onedrive_enabled'== False">
Client Secret: Client Secret:
<field name="onedrive_client_secret" password="True" <field name="onedrive_client_secret" password="True"
invisible="'is_onedrive_enabled'== False" invisible="'is_onedrive_enabled'== False"/>
/>
</span> </span>
</div> </div>
<button class="o_setting_right_pane btn btn-link" <button class="o_setting_right_pane btn btn-link"

Loading…
Cancel
Save