Metadata-Version: 2.1
Name: odoo-addon-microsoft_drive_account
Version: 18.0.2.0.1
Requires-Python: >=3.10
Requires-Dist: odoo==18.0.*
Summary: Link user with Microsoft
Home-page: https://github.com/OCA/storage
License: LGPL-3
Author: ACSONE SA/NV,Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

===========================
Microsoft account for Drive
===========================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:a62ab45f11d8374004463a4dcc823381cdd67e5e72ea05c2a43dd7c4bcef3d2a
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
    :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
    :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github
    :target: https://github.com/OCA/storage/tree/18.0/microsoft_drive_account
    :alt: OCA/storage
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/storage-18-0/storage-18-0-microsoft_drive_account
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/storage&target_branch=18.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This addon allows the user to link their Microsoft Drive account to
Odoo. The stored credentials are then used by other addons to perform
actions on Drive as the logged-in user.

**Table of contents**

.. contents::
   :local:

Configuration
=============

In order to use the Microsoft Drive Account module, you need to follow
this process for link Odoo and Microsoft:

PART 1 : Create an Azure Application
------------------------------------

To allow Odoo to access Microsoft OneDrive or SharePoint through the
Microsoft Graph API, you must create an application in Azure Active
Directory.

Step 1 – Open the Azure portal and go to Azure Active Directory, then
"App registrations", and click “New registration”.

Step 2 – Register the application. Set a name “Odoo storage
integration”. Select the third option "Accounts in any organizational
directory (Any Microsoft Entra ID tenant - Multitenant) and personal
Microsoft accounts (e.g. Skype, Xbox)" Add a Redirect URI of type "Web".
{URL of your Odoo instance}/microsoft_account/authentication. Once the
application is created, note the Application (client) ID and the
Directory (tenant) ID.

|Azure App dashboard|

Step 3 – Generate a client secret. Go to Certificates & secrets, create
a new client secret (Description : Odoo storage secret / Expires :
24month), and copy its value. You will not be able to see it again.

|Secret of Azure App|

Step 4 – Configure API permissions. Open API permissions, add Microsoft
Graph "Application permissions", and include Files.ReadWrite.All, and
Sites.ReadWrite.All. Add also "Delegated permission" for include
offline_access, openid.

IMPORTANT : Grant admin consent so the application can use these
permissions.

|Permissions in Azure App|

PART 2 : Set Odoo System Parameters
-----------------------------------

You need your tenant_url, you can find it in your Azure portal, open
Home > Dashboard. Look at the URL, it's usually ends with
onmicrosoft.com.

|Tenant URL|

In Odoo, open Settings > Technical > System Parameters.

Required parameters:

- microsoft_account.auth_endpoint : This is the Microsoft OAuth2
  authorization URL. It usually has the form:
  `https://login.microsoftonline.com/{tenant_url}/oauth2/v2.0/authorize <https://login.microsoftonline.com/{tenant_url}/oauth2/v2.0/authorize>`__
- microsoft_account.token_endpoint : This is the token endpoint URL,
  usually:
  `https://login.microsoftonline.com/{tenant_url}/oauth2/v2.0/token <https://login.microsoftonline.com/{tenant_url}/oauth2/v2.0/token>`__
- microsoft_drive_client_id : The Client ID of the Azure application.
- microsoft_drive_client_secret : The Client Secret value generated in
  Azure.

Optional parameter :

- microsoft_drive_client_scope : Defines the permissions requested by
  Odoo. If not defined, Odoo uses the default scopes: offline_access,
  openid, Files.ReadWrite.All, Sites.ReadWrite.All.

PART 3 : Test the Configuration
-------------------------------

Step 1 – In Odoo, go to your odoo profile and select "Account
Security",then click on the “grey cloud icon".

Step 2 – You will be redirected to the Microsoft login page. Sign in and
accept the requested permissions. You will then be redirected back to
Odoo.

Step 3 – After authorization, Odoo should display a "blue cloud icon".
The connection is now established.

|Test connexion from odoo profile|

.. |Azure App dashboard| image:: https://raw.githubusercontent.com/OCA/storage/18.0/microsoft_drive_account/static/description/azure_storage_app.png
.. |Secret of Azure App| image:: https://raw.githubusercontent.com/OCA/storage/18.0/microsoft_drive_account/static/description/azure_storage_secret.png
.. |Permissions in Azure App| image:: https://raw.githubusercontent.com/OCA/storage/18.0/microsoft_drive_account/static/description/azure_storage_permissions.png
.. |Tenant URL| image:: https://raw.githubusercontent.com/OCA/storage/18.0/microsoft_drive_account/static/description/azure_storage_tenant_url.png
.. |Test connexion from odoo profile| image:: https://raw.githubusercontent.com/OCA/storage/18.0/microsoft_drive_account/static/description/azure_storage_test.png

Usage
=====

On the user preference page, the user can link their Microsoft Drive
account to Odoo by cliking on the Drive button. This will redirect the
user to the Microsoft authentication page, where they can log in and
grant permission to Odoo to access their Drive account. Once the user
has granted permission, they will be redirected back to Odoo, where
their Drive account will be linked.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/storage/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/storage/issues/new?body=module:%20microsoft_drive_account%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* ACSONE SA/NV

Contributors
------------

- Laurent Mignon <laurent.mignon@acsone.eu>

Other credits
-------------

The development of this module has been financially supported by:

- ACSONE SA/NV

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-lmignon| image:: https://github.com/lmignon.png?size=40px
    :target: https://github.com/lmignon
    :alt: lmignon

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-lmignon| 

This module is part of the `OCA/storage <https://github.com/OCA/storage/tree/18.0/microsoft_drive_account>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
