Files
odoo_source/addons/google_gmail/views/ir_mail_server_views.xml
T
std-odoo dd87eb77f3 [FIX] google_gmail, fetchmail_gmail: use Odoo endpoint for authentication
Purpose
=======
The flow where we copy / paste the authorization code will be
depreciated. Because of that, we know use the newest authentication
system which use redirect URI.

Technical
=========
Now, the user is redirected to an Odoo endpoint "google_gmail/confirm"
and the access token / refresh token are automatically fetched.

Documentation
https://developers.google.com/identity/protocols/oauth2/native-app

Task-2852560

closes odoo/odoo#94476

X-original-commit: 69bd9bc6b36fdd55e8e859667bcddddad6db7d06
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-06-24 10:29:54 +02:00

44 lines
2.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="ir_mail_server_view_form" model="ir.ui.view">
<field name="name">ir.mail_server.view.form.inherit.gmail</field>
<field name="model">ir.mail_server</field>
<field name="inherit_id" ref="base.ir_mail_server_form"/>
<field name="arch" type="xml">
<field name="smtp_user" position="after">
<field name="google_gmail_uri" invisible="1"/>
<field name="google_gmail_refresh_token" invisible="1"/>
<div></div>
<div attrs="{'invisible': [('smtp_authentication', '!=', 'gmail')]}">
<span attrs="{'invisible': ['|', ('smtp_authentication', '!=', 'gmail'), ('google_gmail_refresh_token', '=', False)]}"
class="badge badge-success">
Gmail Token Valid
</span>
<button type="object"
name="open_google_gmail_uri" class="btn-link px-0"
attrs="{'invisible': ['|', '|', ('google_gmail_uri', '=', False), ('smtp_authentication', '!=', 'gmail'), ('google_gmail_refresh_token', '!=', False)]}">
<i class="fa fa-arrow-right"/>
Connect your Gmail account
</button>
<button type="object"
name="open_google_gmail_uri" class="btn-link px-0"
attrs="{'invisible': ['|', '|', ('google_gmail_uri', '=', False), ('smtp_authentication', '!=', 'gmail'), ('google_gmail_refresh_token', '=', False)]}">
<i class="fa fa-cog"/>
Edit Settings
</button>
<div class="alert alert-warning" role="alert"
attrs="{'invisible': ['|', ('smtp_authentication', '!=', 'gmail'), ('google_gmail_uri', '!=', False)]}">
Setup your Gmail API credentials in the general settings to link a Gmail account.
</div>
</div>
</field>
<field name="smtp_user" position="attributes">
<attribute name="attrs">{'invisible' : [('smtp_authentication', '!=', 'login'), ('smtp_authentication', '!=', 'gmail')]}</attribute>
</field>
<field name="smtp_pass" position="attributes">
<attribute name="attrs">{'invisible' : [('smtp_authentication', '=', 'gmail')]}</attribute>
</field>
</field>
</record>
</odoo>