Merge pull request #1470 from automatisch/aut-538

fix(odoo): introduce secure connection option
This commit is contained in:
Ali BARIN
2023-12-11 16:44:11 +01:00
committed by GitHub
2 changed files with 26 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ export default {
readOnly: false, readOnly: false,
value: null, value: null,
placeholder: null, placeholder: null,
description: 'Host name of your Odoo Server', description: 'Host name of your Odoo Server (e.g. sub.domain.com without the protocol)',
clickToCopy: false, clickToCopy: false,
}, },
{ {
@@ -25,6 +25,27 @@ export default {
description: 'Port that the host is running on, defaults to 443 (HTTPS)', description: 'Port that the host is running on, defaults to 443 (HTTPS)',
clickToCopy: false, clickToCopy: false,
}, },
{
key: 'secure',
label: 'Secure',
type: 'dropdown' as const,
required: true,
readOnly: false,
value: 'true',
description: 'True if the host communicates via secure protocol.',
variables: false,
clickToCopy: false,
options: [
{
label: 'True',
value: 'true',
},
{
label: 'False',
value: 'false',
},
],
},
{ {
key: 'databaseName', key: 'databaseName',
label: 'Database Name', label: 'Database Name',
@@ -40,7 +61,7 @@ export default {
key: 'email', key: 'email',
label: 'Email Address', label: 'Email Address',
type: 'string' as const, type: 'string' as const,
requires: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
placeholder: null, placeholder: null,

View File

@@ -32,8 +32,10 @@ export const asyncMethodCall = async <T = number>($: IGlobalVariable, { method,
export const getClient = ($: IGlobalVariable, { path = 'common' }) => { export const getClient = ($: IGlobalVariable, { path = 'common' }) => {
const host = $.auth.data.host as string; const host = $.auth.data.host as string;
const port = Number($.auth.data.port as string); const port = Number($.auth.data.port as string);
const secure = $.auth.data.secure === 'true';
const createClientFunction = secure ? xmlrpc.createSecureClient : xmlrpc.createClient;
return xmlrpc.createClient( return createClientFunction(
{ {
host, host,
port, port,