Browse Source

Aug 30 [UPDT] Updated 'onedrive_integration_odoo'

pull/254/merge
AjmalCybro 8 months ago
parent
commit
6be1fd46b0
  1. 5
      onedrive_integration_odoo/doc/RELEASE_NOTES.md
  2. 11
      onedrive_integration_odoo/models/res_config_settings.py
  3. BIN
      onedrive_integration_odoo/static/description/assets/screenshots/006.png
  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

5
onedrive_integration_odoo/doc/RELEASE_NOTES.md

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

11
onedrive_integration_odoo/models/res_config_settings.py

@ -20,12 +20,14 @@
#
###############################################################################
import json
import logging
import requests
from werkzeug import urls
from odoo import fields, models, _
from odoo.exceptions import UserError
from odoo.http import request
_logger = logging.getLogger(__name__)
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
@ -42,6 +44,10 @@ class ResConfigSettings(models.TransientModel):
onedrive_access_token = fields.Char(
string='Onedrive Access Token',
help='Access token generated from onedrive')
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(
string='Onedrive Refresh Token',
help='Refresh token generated from onedrive')
@ -70,13 +76,16 @@ class ResConfigSettings(models.TransientModel):
'redirect_uri': request.env['ir.config_parameter'].get_param(
'web.base.url') + '/onedrive/authentication'
}
tenant_id = self.env['ir.config_parameter'].get_param(
'onedrive_integration_odoo.tenant_id', '')
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,
headers={"content-type": "application/x-www-form-urlencoded"}
)
response = res.content and res.json() or {}
if 'error' in response:
_logger.warning(response)
raise UserError(_("Error '%s': Please check the credentials.",
response['error']))
else:

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 200 KiB

2
onedrive_integration_odoo/static/description/index.html

@ -264,7 +264,7 @@
Tokens button will redirect to an authorization
page.
Goto --> Settngs-->Integrations</p>
<img src="assets/screenshots/6.png"
<img src="assets/screenshots/006.png"
class="img-thumbnail">
</div>

7
onedrive_integration_odoo/views/res_config_settings_views.xml

@ -39,6 +39,13 @@
attrs="{'invisible': [('is_onedrive_integration', '=', False)]}"/>
</span>
</div>
<div class="o_setting_right_pane">
<span attrs="{'invisible': [('is_onedrive_integration', '=', False)]}">
Tenant Id:
<field name="onedrive_tenant_id"
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_integration', '=', False)]}">

Loading…
Cancel
Save