将 Google 日历与 Odoo 同步¶
将 Google 日历与 Odoo 同步,可同时查看和管理两个平台上的会议(双向更新)。这种整合有助于安排日程,从而避免错过会议。
在Google中设定¶
选择(或创建)一个项目¶
创建一个新的 Google API 项目并启用 Google 日历。首先,访问 `Google API 控制台<https://console.developers.google.com>`_并登录 Google 账户。
備註
如果是首次访问此页面,Google 将提示用户输入国家/地区并同意服务条款。请从下拉列表中选择一个国家,并同意 ToS(服务条款)。
接下来,单击:guilabel:选择项目`并选择(或创建)一个 API 项目,以便在其中配置 OAuth 和存储凭据。单击 :guilabel:`新建项目
。
小訣竅
为 API 项目起一个清晰的名称,例如“Odoo Sync”,以便您轻松找到它。
启用 Google 日历 API¶
现在,点击左侧菜单中的 启用 API 和服务。如果没有出现 搜索栏,请再次选择 启用 API 和服务。
然后,使用搜索栏搜索 Google 日历 API
,并从搜索结果中选择 Google 日历 API。点击 启用。
OAuth 同意屏幕¶
现在 API 项目已创建,应配置 OAuth。为此,请单击左侧菜单中的 OAuth 许可,然后选择 用户类型。
警告
个人 Gmail 帐户只允许使用**外部**用户类型,这意味着 Google 可能需要批准或添加*范围*。不过,使用*Google 工作空间*账户可以使用**内部**用户类型。
请注意,当 API 连接处于*外部*测试模式时,无需获得 Google 批准。该测试模式下的用户限制为 100 个。
在第二步 OAuth 同意屏幕 中,在 应用程序名称 字段中输入 Odoo
,在 用户支持电子邮件 字段中选择电子邮件地址,在 开发者联系信息 部分中输入电子邮件地址。然后,单击 保存并继续。
单击 保存并继续 跳过第三步,即 。
接下来,如果继续测试模式(外部),请通过点击 添加用户 添加在 测试用户 步骤下配置的电子邮件地址,然后点击 保存并继续 按钮。应用程序注册摘要将出现。
最后,滚动到底部,点击 返回仪表板。
现在,OAuth 授权已经配置好了,是时候创建凭据了。
创建凭据¶
要将 Google 日历连接到 Odoo,需要 客户 ID 和 客户密钥。这是 Google 控制台的最后一步。首先点击左侧菜单中的 证书。然后,单击 创建凭据,并选择 OAuth 客户端 ID,Google 将打开创建凭据的指南。
在 应用类型 字段选择 网站申请,并为 名称 键入 我的 Odoo 数据库
。
在 经授权 JavaScript Origins 部分,单击 + 添加 URI 并键入公司的 Odoo 完整 URL (统一资源定位器) 地址。
在 经授权重新定向 URIs 部分,单击 + 添加 URI,然后键入公司的 Odoo URL(统一资源定位符) 地址,后面跟上`/google_account/authentication`。最后,点击 创建。
将显示 客户 ID 和 客户密钥,将其复制到记事本中。
设置Odoo¶
找到 客户 ID 和 客户密钥 后,打开 Odoo 数据库并转到 Google 日历 旁边的复选框。
。选中接下来,将 Google 日历 API 证书页面中的 客户 ID 和 客户密钥 复制并粘贴到 Google 日历 复选框下方的相应字段中。然后,单击 保存。
在 Odoo 中同步日历¶
最后,打开 Odoo 中的 Google 同步按钮,将 Google 日历与 Odoo 同步。
应用程序,点击備註
首次将 Google 日历与 Odoo 同步时,页面将重定向到 Google 账户。在那里,选择应具有访问权限的 电子邮件账户,然后选择 继续`(如果应用程序未经验证),最后选择 :guilabel:`继续`(允许传输数据)。
现在,Odoo 日历已成功与 Google 日历同步!
警告
Odoo 强烈建议在测试数据库和测试电子邮件地址(不用于任何其他目的)上测试 Google 日历同步,然后再尝试将所需的 Google 日历与用户的生产数据库同步。
一旦用户将 Google 日历与 Odoo 日历同步后:
在 Odoo 中创建活动会导致 Google 向所有参与者发送邀请。
在 Odoo 中删除活动会导致 Google 向所有参与者发送取消通知。
将联系人添加到活动会导致 Google 向所有参与者发送邀请。
从活动中删除联系人会导致 Google 向所有参与者发送取消通知。
Events can be created in Google Calendar without sending a notification by selecting Don’t Send when prompted to send invitation emails.
Troubleshoot sync¶
There may be times when the Google Calendar account does not sync correctly with Odoo. Sync issues can be seen in the database logs.
In these cases, the account needs troubleshooting. A reset can be performed using the Reset Account button, which can be accessed by navigating to . Then, select the user to modify the calendar, and click the Calendar tab.
Next, click Reset Account under the correct calendar.
Reset options¶
The following reset options are available for troubleshooting Google calendar sync with Odoo:
User’s Existing Events:
Leave them untouched: no changes to the events.
Delete from the current Google Calendar account: delete the events from Google Calendar.
Delete from Odoo: delete the events from the Odoo calendar.
Delete from both: delete the events from both Google Calendar and Odoo calendar.
Next Synchronization:
Synchronize only new events: sync new events on Google Calendar and/or Odoo calendar.
Synchronize all existing events: sync all events on Google Calendar and/or Odoo calendar.
Click Confirm after making the selection to modify the user’s events and the calendar synchronization.
Google OAuth FAQ¶
At times there can be misconfigurations that take place, and troubleshooting is needed to resolve the issue. Below are the most common errors that may occur when configuring the Google Calendar for use with Odoo.
Production vs. testing publishing status¶
Choosing Production as the Publishing Status (instead of Testing) displays the following warning message:
OAuth is limited to 100 sensitive scope logins until the OAuth consent screen is verified. This may
require a verification process that can take several days.
To correct this warning, navigate to the Google API Platform. If the Publishing Status is In Production, click Back to Testing to correct the issue.
No test users added¶
If no test users are added to the OAuth consent screen, then an Error 403: access_denied populates.
To correct this error, return to the OAuth consent screen, under APIs & Services, and add test users to the app. Add the email to be configured in Odoo.
Application Type¶
When creating the credentials (OAuth Client ID and Client Secret), if Desktop App is selected for the Application Type, an Authorization Error appears (Error 400:redirect_uri_mismatch).
To correct this error, delete the existing credentials, and create new credentials, by selecting Web Application for the Application Type.
Then, under Authorized redirect URIs, click ADD URI, and type:
https://yourdbname.odoo.com/google_account/authentication
in the field, being sure to replace
yourdbname in the URL with the real Odoo database name.
小訣竅
Ensure that the domain (used in the URI:
https://yourdbname.odoo.com/google_account/authentication
) is the exact same domain as
configured in the web.base.url
system parameter.
Access the web.base.url
by activating developer mode, and navigating to
.