Skip to content

Commit

Permalink
fix(odoo): introduce secure connection option
Browse files Browse the repository at this point in the history
  • Loading branch information
barinali committed Dec 11, 2023
1 parent aefff5c commit 79d4edd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 22 additions & 1 deletion packages/backend/src/apps/odoo/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
readOnly: false,
value: 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,
},
{
Expand All @@ -25,6 +25,27 @@ export default {
description: 'Port that the host is running on, defaults to 443 (HTTPS)',
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',
label: 'Database Name',
Expand Down
4 changes: 3 additions & 1 deletion packages/backend/src/apps/odoo/common/xmlrpc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export const asyncMethodCall = async <T = number>($: IGlobalVariable, { method,
export const getClient = ($: IGlobalVariable, { path = 'common' }) => {
const host = $.auth.data.host 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,
port,
Expand Down

0 comments on commit 79d4edd

Please sign in to comment.