first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,429 @@
import type {
IDataObject,
IExecuteFunctions,
IHookFunctions,
ILoadOptionsFunctions,
JsonObject,
IRequestOptions,
} from 'n8n-workflow';
import { NodeApiError, randomInt } from 'n8n-workflow';
const serviceJSONRPC = 'object';
const methodJSONRPC = 'execute';
export const mapOperationToJSONRPC = {
create: 'create',
get: 'read',
getAll: 'search_read',
update: 'write',
delete: 'unlink',
};
export const mapOdooResources: { [key: string]: string } = {
contact: 'res.partner',
opportunity: 'crm.lead',
note: 'note.note',
};
export const mapFilterOperationToJSONRPC = {
equal: '=',
notEqual: '!=',
greaterThen: '>',
lesserThen: '<',
greaterOrEqual: '>=',
lesserOrEqual: '<=',
like: 'like',
in: 'in',
notIn: 'not in',
childOf: 'child_of',
};
type FilterOperation =
| 'equal'
| 'notEqual'
| 'greaterThen'
| 'lesserThen'
| 'greaterOrEqual'
| 'lesserOrEqual'
| 'like'
| 'in'
| 'notIn'
| 'childOf';
export interface IOdooFilterOperations {
filter: Array<{
fieldName: string;
operator: string;
value: string;
}>;
}
export interface IOdooNameValueFields {
fields: Array<{
fieldName: string;
fieldValue: string;
}>;
}
export interface IOdooResponseFields {
fields: Array<{
field: string;
fromList?: boolean;
}>;
}
type OdooCRUD = 'create' | 'update' | 'delete' | 'get' | 'getAll';
export function odooGetDBName(databaseName: string | undefined, url: string) {
if (databaseName) return databaseName;
const odooURL = new URL(url);
const hostname = odooURL.hostname;
if (!hostname) return '';
return odooURL.hostname.split('.')[0];
}
function processFilters(value: IOdooFilterOperations) {
return value.filter?.map((item) => {
const operator = item.operator as FilterOperation;
item.operator = mapFilterOperationToJSONRPC[operator];
return Object.values(item);
});
}
export function processNameValueFields(value: IDataObject) {
const data = value as unknown as IOdooNameValueFields;
return data?.fields?.reduce((acc, record) => {
return Object.assign(acc, { [record.fieldName]: record.fieldValue });
}, {});
}
// function processResponseFields(value: IDataObject) {
// const data = value as unknown as IOdooResponseFields;
// return data?.fields?.map((entry) => entry.field);
// }
export async function odooJSONRPCRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
body: IDataObject,
url: string,
): Promise<IDataObject | IDataObject[]> {
try {
const options: IRequestOptions = {
headers: {
'User-Agent': 'n8n',
Connection: 'keep-alive',
Accept: '*/*',
'Content-Type': 'application/json',
},
method: 'POST',
body,
uri: `${url}/jsonrpc`,
json: true,
};
const response = await this.helpers.request(options);
if (response.error) {
throw new NodeApiError(this.getNode(), response.error.data as JsonObject, {
message: response.error.data.message,
});
}
return response.result;
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function odooGetModelFields(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
db: string,
userID: number,
password: string,
resource: string,
url: string,
) {
try {
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: serviceJSONRPC,
method: methodJSONRPC,
args: [
db,
userID,
password,
mapOdooResources[resource] || resource,
'fields_get',
[],
['string', 'type', 'help', 'required', 'name'],
],
},
id: randomInt(100),
};
const result = await odooJSONRPCRequest.call(this, body, url);
return result;
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function odooCreate(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
db: string,
userID: number,
password: string,
resource: string,
operation: OdooCRUD,
url: string,
newItem: IDataObject,
) {
try {
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: serviceJSONRPC,
method: methodJSONRPC,
args: [
db,
userID,
password,
mapOdooResources[resource] || resource,
mapOperationToJSONRPC[operation],
newItem || {},
],
},
id: randomInt(100),
};
const result = await odooJSONRPCRequest.call(this, body, url);
return { id: result };
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function odooGet(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
db: string,
userID: number,
password: string,
resource: string,
operation: OdooCRUD,
url: string,
itemsID: string,
fieldsToReturn?: IDataObject[],
) {
try {
if (!/^\d+$/.test(itemsID) || !parseInt(itemsID, 10)) {
throw new NodeApiError(this.getNode(), {
status: 'Error',
message: `Please specify a valid ID: ${itemsID}`,
});
}
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: serviceJSONRPC,
method: methodJSONRPC,
args: [
db,
userID,
password,
mapOdooResources[resource] || resource,
mapOperationToJSONRPC[operation],
itemsID ? [+itemsID] : [],
fieldsToReturn || [],
],
},
id: randomInt(100),
};
const result = await odooJSONRPCRequest.call(this, body, url);
return result;
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function odooGetAll(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
db: string,
userID: number,
password: string,
resource: string,
operation: OdooCRUD,
url: string,
filters?: IOdooFilterOperations,
fieldsToReturn?: IDataObject[],
limit = 0,
) {
try {
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: serviceJSONRPC,
method: methodJSONRPC,
args: [
db,
userID,
password,
mapOdooResources[resource] || resource,
mapOperationToJSONRPC[operation],
(filters && processFilters(filters)) || [],
fieldsToReturn || [],
0, // offset
limit,
],
},
id: randomInt(100),
};
const result = await odooJSONRPCRequest.call(this, body, url);
return result;
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function odooUpdate(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
db: string,
userID: number,
password: string,
resource: string,
operation: OdooCRUD,
url: string,
itemsID: string,
fieldsToUpdate: IDataObject,
) {
try {
if (!Object.keys(fieldsToUpdate).length) {
throw new NodeApiError(this.getNode(), {
status: 'Error',
message: 'Please specify at least one field to update',
});
}
if (!/^\d+$/.test(itemsID) || !parseInt(itemsID, 10)) {
throw new NodeApiError(this.getNode(), {
status: 'Error',
message: `Please specify a valid ID: ${itemsID}`,
});
}
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: serviceJSONRPC,
method: methodJSONRPC,
args: [
db,
userID,
password,
mapOdooResources[resource] || resource,
mapOperationToJSONRPC[operation],
itemsID ? [+itemsID] : [],
fieldsToUpdate,
],
},
id: randomInt(100),
};
await odooJSONRPCRequest.call(this, body, url);
return { id: itemsID };
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function odooDelete(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
db: string,
userID: number,
password: string,
resource: string,
operation: OdooCRUD,
url: string,
itemsID: string,
) {
if (!/^\d+$/.test(itemsID) || !parseInt(itemsID, 10)) {
throw new NodeApiError(this.getNode(), {
status: 'Error',
message: `Please specify a valid ID: ${itemsID}`,
});
}
try {
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: serviceJSONRPC,
method: methodJSONRPC,
args: [
db,
userID,
password,
mapOdooResources[resource] || resource,
mapOperationToJSONRPC[operation],
itemsID ? [+itemsID] : [],
],
},
id: randomInt(100),
};
await odooJSONRPCRequest.call(this, body, url);
return { success: true };
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function odooGetUserID(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
db: string,
username: string,
password: string,
url: string,
): Promise<number> {
try {
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: 'common',
method: 'login',
args: [db, username, password],
},
id: randomInt(100),
};
const loginResult = await odooJSONRPCRequest.call(this, body, url);
return loginResult as unknown as number;
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function odooGetServerVersion(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
url: string,
) {
try {
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: 'common',
method: 'version',
args: [],
},
id: randomInt(100),
};
const result = await odooJSONRPCRequest.call(this, body, url);
return result;
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -0,0 +1,19 @@
{
"node": "n8n-nodes-base.odoo",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Data & Storage"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/odoo/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.odoo/"
}
]
},
"alias": ["ERP"]
}
+760
View File
@@ -0,0 +1,760 @@
import { capitalCase } from 'change-case';
import type {
IExecuteFunctions,
ICredentialsDecrypted,
ICredentialTestFunctions,
IDataObject,
ILoadOptionsFunctions,
INodeCredentialTestResult,
INodeExecutionData,
INodePropertyOptions,
INodeType,
INodeTypeDescription,
IRequestOptions,
} from 'n8n-workflow';
import { NodeConnectionTypes, deepCopy, randomInt } from 'n8n-workflow';
import {
contactDescription,
contactOperations,
customResourceDescription,
customResourceOperations,
noteDescription,
noteOperations,
opportunityDescription,
opportunityOperations,
} from './descriptions';
import type { IOdooFilterOperations } from './GenericFunctions';
import {
odooCreate,
odooDelete,
odooGet,
odooGetAll,
odooGetDBName,
odooGetModelFields,
odooGetUserID,
odooJSONRPCRequest,
odooUpdate,
processNameValueFields,
} from './GenericFunctions';
export class Odoo implements INodeType {
description: INodeTypeDescription = {
displayName: 'Odoo',
name: 'odoo',
icon: 'file:odoo.svg',
group: ['transform'],
version: 1,
description: 'Consume Odoo API',
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
defaults: {
name: 'Odoo',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'odooApi',
required: true,
testedBy: 'odooApiTest',
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
default: 'contact',
noDataExpression: true,
options: [
{
name: 'Contact',
value: 'contact',
},
{
name: 'Custom Resource',
value: 'custom',
},
{
name: 'Note',
value: 'note',
},
{
name: 'Opportunity',
value: 'opportunity',
},
],
},
...customResourceOperations,
...customResourceDescription,
...opportunityOperations,
...opportunityDescription,
...contactOperations,
...contactDescription,
...noteOperations,
...noteDescription,
],
};
methods = {
loadOptions: {
async getModelFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
let resource;
resource = this.getCurrentNodeParameter('resource') as string;
if (resource === 'custom') {
resource = this.getCurrentNodeParameter('customResource') as string;
if (!resource) return [];
}
const credentials = await this.getCredentials('odooApi');
const url = credentials.url as string;
const username = credentials.username as string;
const password = credentials.password as string;
const db = odooGetDBName(credentials.db as string, url);
const userID = await odooGetUserID.call(this, db, username, password, url);
const response = await odooGetModelFields.call(this, db, userID, password, resource, url);
const options = Object.entries(response).map(([key, field]) => {
const optionField = field as { [key: string]: string };
try {
optionField.name = capitalCase(optionField.name);
} catch (error) {
optionField.name = optionField.string;
}
return {
name: optionField.name,
value: key,
// nodelinter-ignore-next-line
description: `name: ${key}, type: ${optionField?.type} required: ${optionField?.required}`,
};
});
return options.sort((a, b) => a.name?.localeCompare(b.name) || 0);
},
async getModels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const credentials = await this.getCredentials('odooApi');
const url = credentials.url as string;
const username = credentials.username as string;
const password = credentials.password as string;
const db = odooGetDBName(credentials.db as string, url);
const userID = await odooGetUserID.call(this, db, username, password, url);
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: 'object',
method: 'execute',
args: [db, userID, password, 'ir.model', 'search_read', [], ['name', 'model']],
},
id: randomInt(100),
};
const response = (await odooJSONRPCRequest.call(this, body, url)) as IDataObject[];
const options = response.map((model) => {
return {
name: model.name,
value: model.model,
description: `model: ${model.model}`,
};
});
return options as INodePropertyOptions[];
},
async getStates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const credentials = await this.getCredentials('odooApi');
const url = credentials.url as string;
const username = credentials.username as string;
const password = credentials.password as string;
const db = odooGetDBName(credentials.db as string, url);
const userID = await odooGetUserID.call(this, db, username, password, url);
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: 'object',
method: 'execute',
args: [db, userID, password, 'res.country.state', 'search_read', [], ['id', 'name']],
},
id: randomInt(100),
};
const response = (await odooJSONRPCRequest.call(this, body, url)) as IDataObject[];
const options = response.map((state) => {
return {
name: state.name as string,
value: state.id,
};
});
return options.sort((a, b) => a.name?.localeCompare(b.name) || 0) as INodePropertyOptions[];
},
async getCountries(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const credentials = await this.getCredentials('odooApi');
const url = credentials.url as string;
const username = credentials.username as string;
const password = credentials.password as string;
const db = odooGetDBName(credentials.db as string, url);
const userID = await odooGetUserID.call(this, db, username, password, url);
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: 'object',
method: 'execute',
args: [db, userID, password, 'res.country', 'search_read', [], ['id', 'name']],
},
id: randomInt(100),
};
const response = (await odooJSONRPCRequest.call(this, body, url)) as IDataObject[];
const options = response.map((country) => {
return {
name: country.name as string,
value: country.id,
};
});
return options.sort((a, b) => a.name?.localeCompare(b.name) || 0) as INodePropertyOptions[];
},
},
credentialTest: {
async odooApiTest(
this: ICredentialTestFunctions,
credential: ICredentialsDecrypted,
): Promise<INodeCredentialTestResult> {
const credentials = credential.data;
try {
const body = {
jsonrpc: '2.0',
method: 'call',
params: {
service: 'common',
method: 'login',
args: [
odooGetDBName(credentials?.db as string, credentials?.url as string),
credentials?.username,
credentials?.password,
],
},
id: randomInt(100),
};
const options: IRequestOptions = {
headers: {
'User-Agent': 'n8n',
Connection: 'keep-alive',
Accept: '*/*',
'Content-Type': 'application/json',
},
method: 'POST',
body,
uri: `${(credentials?.url as string).replace(/\/$/, '')}/jsonrpc`,
json: true,
};
const result = await this.helpers.request(options);
if (result.error || !result.result) {
return {
status: 'Error',
message: 'Credentials are not valid',
};
} else if (result.error) {
return {
status: 'Error',
message: `Credentials are not valid: ${result.error.data.message}`,
};
}
} catch (error) {
return {
status: 'Error',
message: `Settings are not valid: ${error}`,
};
}
return {
status: 'OK',
message: 'Authentication successful!',
};
},
},
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
let items = this.getInputData();
items = deepCopy(items);
const returnData: INodeExecutionData[] = [];
let responseData;
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
const credentials = await this.getCredentials('odooApi');
const url = (credentials.url as string).replace(/\/$/, '');
const username = credentials.username as string;
const password = credentials.password as string;
const db = odooGetDBName(credentials.db as string, url);
const userID = await odooGetUserID.call(this, db, username, password, url);
//----------------------------------------------------------------------
// Main loop
//----------------------------------------------------------------------
for (let i = 0; i < items.length; i++) {
try {
if (resource === 'contact') {
if (operation === 'create') {
let additionalFields = this.getNodeParameter('additionalFields', i);
if (additionalFields.address) {
const addressFields = (additionalFields.address as IDataObject).value as IDataObject;
if (addressFields) {
additionalFields = {
...additionalFields,
...addressFields,
};
}
delete additionalFields.address;
}
const name = this.getNodeParameter('contactName', i) as string;
const fields: IDataObject = {
name,
...additionalFields,
};
responseData = await odooCreate.call(
this,
db,
userID,
password,
resource,
operation,
url,
fields,
);
}
if (operation === 'delete') {
const contactId = this.getNodeParameter('contactId', i) as string;
responseData = await odooDelete.call(
this,
db,
userID,
password,
resource,
operation,
url,
contactId,
);
}
if (operation === 'get') {
const contactId = this.getNodeParameter('contactId', i) as string;
const options = this.getNodeParameter('options', i);
const fields = (options.fieldsList as IDataObject[]) || [];
responseData = await odooGet.call(
this,
db,
userID,
password,
resource,
operation,
url,
contactId,
fields,
);
}
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', i);
const options = this.getNodeParameter('options', i);
const fields = (options.fieldsList as IDataObject[]) || [];
if (returnAll) {
responseData = await odooGetAll.call(
this,
db,
userID,
password,
resource,
operation,
url,
undefined,
fields,
);
} else {
const limit = this.getNodeParameter('limit', i);
responseData = await odooGetAll.call(
this,
db,
userID,
password,
resource,
operation,
url,
undefined, // filters, only for custom resource
fields,
limit,
);
}
}
if (operation === 'update') {
const contactId = this.getNodeParameter('contactId', i) as string;
let updateFields = this.getNodeParameter('updateFields', i);
if (updateFields.address) {
const addressFields = (updateFields.address as IDataObject).value as IDataObject;
if (addressFields) {
updateFields = {
...updateFields,
...addressFields,
};
}
delete updateFields.address;
}
responseData = await odooUpdate.call(
this,
db,
userID,
password,
resource,
operation,
url,
contactId,
updateFields,
);
}
}
if (resource === 'custom') {
const customResource = this.getNodeParameter('customResource', i) as string;
if (operation === 'create') {
const fields = this.getNodeParameter('fieldsToCreateOrUpdate', i) as IDataObject;
responseData = await odooCreate.call(
this,
db,
userID,
password,
customResource,
operation,
url,
processNameValueFields(fields),
);
}
if (operation === 'delete') {
const customResourceId = this.getNodeParameter('customResourceId', i) as string;
responseData = await odooDelete.call(
this,
db,
userID,
password,
customResource,
operation,
url,
customResourceId,
);
}
if (operation === 'get') {
const customResourceId = this.getNodeParameter('customResourceId', i) as string;
const options = this.getNodeParameter('options', i);
const fields = (options.fieldsList as IDataObject[]) || [];
responseData = await odooGet.call(
this,
db,
userID,
password,
customResource,
operation,
url,
customResourceId,
fields,
);
}
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', i);
const options = this.getNodeParameter('options', i);
const fields = (options.fieldsList as IDataObject[]) || [];
const filter = this.getNodeParameter('filterRequest', i) as IOdooFilterOperations;
if (returnAll) {
responseData = await odooGetAll.call(
this,
db,
userID,
password,
customResource,
operation,
url,
filter,
fields,
);
} else {
const limit = this.getNodeParameter('limit', i);
responseData = await odooGetAll.call(
this,
db,
userID,
password,
customResource,
operation,
url,
filter,
fields,
limit,
);
}
}
if (operation === 'update') {
const customResourceId = this.getNodeParameter('customResourceId', i) as string;
const fields = this.getNodeParameter('fieldsToCreateOrUpdate', i) as IDataObject;
responseData = await odooUpdate.call(
this,
db,
userID,
password,
customResource,
operation,
url,
customResourceId,
processNameValueFields(fields),
);
}
}
if (resource === 'note') {
if (operation === 'create') {
// const additionalFields = this.getNodeParameter('additionalFields', i);
const memo = this.getNodeParameter('memo', i) as string;
const fields: IDataObject = {
memo,
// ...additionalFields,
};
responseData = await odooCreate.call(
this,
db,
userID,
password,
resource,
operation,
url,
fields,
);
}
if (operation === 'delete') {
const noteId = this.getNodeParameter('noteId', i) as string;
responseData = await odooDelete.call(
this,
db,
userID,
password,
resource,
operation,
url,
noteId,
);
}
if (operation === 'get') {
const noteId = this.getNodeParameter('noteId', i) as string;
const options = this.getNodeParameter('options', i);
const fields = (options.fieldsList as IDataObject[]) || [];
responseData = await odooGet.call(
this,
db,
userID,
password,
resource,
operation,
url,
noteId,
fields,
);
}
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', i);
const options = this.getNodeParameter('options', i);
const fields = (options.fieldsList as IDataObject[]) || [];
if (returnAll) {
responseData = await odooGetAll.call(
this,
db,
userID,
password,
resource,
operation,
url,
undefined,
fields,
);
} else {
const limit = this.getNodeParameter('limit', i);
responseData = await odooGetAll.call(
this,
db,
userID,
password,
resource,
operation,
url,
undefined, // filters, only for custom resource
fields,
limit,
);
}
}
if (operation === 'update') {
const noteId = this.getNodeParameter('noteId', i) as string;
const memo = this.getNodeParameter('memo', i) as string;
const fields: IDataObject = {
memo,
};
responseData = await odooUpdate.call(
this,
db,
userID,
password,
resource,
operation,
url,
noteId,
fields,
);
}
}
if (resource === 'opportunity') {
if (operation === 'create') {
const additionalFields = this.getNodeParameter('additionalFields', i);
const name = this.getNodeParameter('opportunityName', i) as string;
const fields: IDataObject = {
name,
...additionalFields,
};
responseData = await odooCreate.call(
this,
db,
userID,
password,
resource,
operation,
url,
fields,
);
}
if (operation === 'delete') {
const opportunityId = this.getNodeParameter('opportunityId', i) as string;
responseData = await odooDelete.call(
this,
db,
userID,
password,
resource,
operation,
url,
opportunityId,
);
}
if (operation === 'get') {
const opportunityId = this.getNodeParameter('opportunityId', i) as string;
const options = this.getNodeParameter('options', i);
const fields = (options.fieldsList as IDataObject[]) || [];
responseData = await odooGet.call(
this,
db,
userID,
password,
resource,
operation,
url,
opportunityId,
fields,
);
}
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', i);
const options = this.getNodeParameter('options', i);
const fields = (options.fieldsList as IDataObject[]) || [];
if (returnAll) {
responseData = await odooGetAll.call(
this,
db,
userID,
password,
resource,
operation,
url,
undefined,
fields,
);
} else {
const limit = this.getNodeParameter('limit', i);
responseData = await odooGetAll.call(
this,
db,
userID,
password,
resource,
operation,
url,
undefined, // filters, only for custom resource
fields,
limit,
);
}
}
if (operation === 'update') {
const opportunityId = this.getNodeParameter('opportunityId', i) as string;
const updateFields = this.getNodeParameter('updateFields', i);
responseData = await odooUpdate.call(
this,
db,
userID,
password,
resource,
operation,
url,
opportunityId,
updateFields,
);
}
}
if (responseData !== undefined) {
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
returnData.push(...executionData);
}
} catch (error) {
if (this.continueOnFail()) {
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
);
returnData.push(...executionData);
continue;
}
throw error;
}
}
return [returnData];
}
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"id": {
"type": "integer"
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"id": {
"type": "integer"
}
},
"version": 4
}
@@ -0,0 +1,12 @@
{
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
},
"version": 4
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"id": {
"type": "integer"
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,12 @@
{
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
},
"version": 3
}
@@ -0,0 +1,12 @@
{
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
},
"version": 6
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"id": {
"type": "integer"
}
},
"version": 1
}
@@ -0,0 +1,54 @@
{
"type": "object",
"properties": {
"__last_update": {
"type": "string"
},
"active": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"kanban_state": {
"type": "string"
},
"lost_reason": {
"type": "boolean"
},
"name": {
"type": "string"
},
"order_ids": {
"type": "array",
"items": {
"type": "integer"
}
},
"priority": {
"type": "string"
},
"sale_amount_total": {
"type": "integer"
},
"sale_order_count": {
"type": "integer"
},
"type": {
"type": "string"
},
"website_message_ids": {
"type": "array",
"items": {
"type": "integer"
}
},
"won_status": {
"type": "string"
},
"write_date": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,18 @@
{
"type": "object",
"properties": {
"create_date": {
"type": "string"
},
"display_name": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
},
"version": 8
}
@@ -0,0 +1,414 @@
import type { INodeProperties } from 'n8n-workflow';
export const contactOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'create',
noDataExpression: true,
displayOptions: {
show: {
resource: ['contact'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a new contact',
action: 'Create a contact',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a contact',
action: 'Delete a contact',
},
{
name: 'Get',
value: 'get',
description: 'Get a contact',
action: 'Get a contact',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many contacts',
action: 'Get many contacts',
},
{
name: 'Update',
value: 'update',
description: 'Update a contact',
action: 'Update a contact',
},
],
},
];
export const contactDescription: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* contact:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Name',
name: 'contactName',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['contact'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['create'],
resource: ['contact'],
},
},
options: [
{
displayName: 'Address',
name: 'address',
type: 'fixedCollection',
default: {},
placeholder: 'Add Address',
typeOptions: {
multipleValues: false,
},
options: [
{
name: 'value',
displayName: 'Address',
values: [
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
},
{
displayName: 'Country Name or ID',
name: 'country_id',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getCountries',
},
},
{
displayName: 'State Name or ID',
name: 'state_id',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getStates',
},
},
{
displayName: 'Street',
name: 'street',
type: 'string',
default: '',
},
{
displayName: 'Street 2',
name: 'street2',
type: 'string',
default: '',
},
{
displayName: 'Zip Code',
name: 'zip',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
default: '',
},
{
displayName: 'Internal Notes',
name: 'comment',
type: 'string',
default: '',
},
{
displayName: 'Job Position',
name: 'function',
type: 'string',
default: '',
},
{
displayName: 'Mobile',
name: 'mobile',
type: 'string',
default: '',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
},
{
displayName: 'Tax ID',
name: 'vat',
type: 'string',
default: '',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
},
],
},
/* -------------------------------------------------------------------------- */
/* contact:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['get', 'delete'],
resource: ['contact'],
},
},
},
/* -------------------------------------------------------------------------- */
/* contact:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 1000,
},
description: 'Max number of results to return',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['getAll', 'get'],
resource: ['contact'],
},
},
options: [
{
displayName: 'Fields to Include',
name: 'fieldsList',
type: 'multiOptions',
description:
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getModelFields',
},
},
],
},
/* -------------------------------------------------------------------------- */
/* contact:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['update'],
resource: ['contact'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['update'],
resource: ['contact'],
},
},
options: [
{
displayName: 'Address',
name: 'address',
type: 'fixedCollection',
default: {},
placeholder: 'Add Address',
typeOptions: {
multipleValues: false,
},
options: [
{
name: 'value',
displayName: 'Address',
values: [
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
},
{
displayName: 'Country Name or ID',
name: 'country_id',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getCountries',
},
},
{
displayName: 'State Name or ID',
name: 'state_id',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getStates',
},
},
{
displayName: 'Street',
name: 'street',
type: 'string',
default: '',
},
{
displayName: 'Street 2',
name: 'street2',
type: 'string',
default: '',
},
{
displayName: 'Zip Code',
name: 'zip',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
default: '',
},
{
displayName: 'Internal Notes',
name: 'comment',
type: 'string',
default: '',
},
{
displayName: 'Job Position',
name: 'function',
type: 'string',
default: '',
},
{
displayName: 'Mobile',
name: 'mobile',
type: 'string',
default: '',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
},
{
displayName: 'Tax ID',
name: 'vat',
type: 'string',
default: '',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
},
],
},
];
@@ -0,0 +1,344 @@
import type { INodeProperties } from 'n8n-workflow';
export const customResourceOperations: INodeProperties[] = [
{
displayName: 'Custom Resource Name or ID',
name: 'customResource',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getModels',
},
displayOptions: {
show: {
resource: ['custom'],
},
},
},
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'create',
noDataExpression: true,
displayOptions: {
show: {
resource: ['custom'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a new item',
action: 'Create an item',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete an item',
action: 'Delete an item',
},
{
name: 'Get',
value: 'get',
description: 'Get an item',
action: 'Get an item',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many items',
action: 'Get many items',
},
{
name: 'Update',
value: 'update',
description: 'Update an item',
action: 'Update an item',
},
],
},
];
export const customResourceDescription: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* custom:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Fields',
name: 'fieldsToCreateOrUpdate',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
multipleValueButtonText: 'Add Field',
},
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['create'],
resource: ['custom'],
},
},
options: [
{
displayName: 'Field Record:',
name: 'fields',
values: [
{
displayName: 'Field Name or ID',
name: 'fieldName',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getModelFields',
},
},
{
displayName: 'New Value',
name: 'fieldValue',
type: 'string',
default: '',
},
],
},
],
},
/* -------------------------------------------------------------------------- */
/* custom:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Custom Resource ID',
name: 'customResourceId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['get', 'delete'],
resource: ['custom'],
},
},
},
/* -------------------------------------------------------------------------- */
/* custom:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['custom'],
operation: ['getAll'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
displayOptions: {
show: {
resource: ['custom'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 1000,
},
description: 'Max number of results to return',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['getAll', 'get'],
resource: ['custom'],
},
},
options: [
{
displayName: 'Fields to Include',
name: 'fieldsList',
type: 'multiOptions',
description:
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getModelFields',
loadOptionsDependsOn: ['customResource'],
},
},
],
},
{
displayName: 'Filters',
name: 'filterRequest',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
multipleValueButtonText: 'Add Filter',
},
default: {},
description: 'Filter request by applying filters',
placeholder: 'Add condition',
displayOptions: {
show: {
operation: ['getAll'],
resource: ['custom'],
},
},
options: [
{
name: 'filter',
displayName: 'Filter',
values: [
{
displayName: 'Field Name or ID',
name: 'fieldName',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsDependsOn: ['customResource'],
loadOptionsMethod: 'getModelFields',
},
},
{
displayName: 'Operator',
name: 'operator',
type: 'options',
default: 'equal',
description: 'Specify an operator',
options: [
{
name: '!=',
value: 'notEqual',
},
{
name: '<',
value: 'lesserThen',
},
{
name: '<=',
value: 'lesserOrEqual',
},
{
name: '=',
value: 'equal',
},
{
name: '>',
value: 'greaterThen',
},
{
name: '>=',
value: 'greaterOrEqual',
},
{
name: 'Child Of',
value: 'childOf',
},
{
name: 'In',
value: 'in',
},
{
name: 'Like',
value: 'like',
},
{
name: 'Not In',
value: 'notIn',
},
],
},
{
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
description: 'Specify value for comparison',
},
],
},
],
},
/* -------------------------------------------------------------------------- */
/* custom:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Custom Resource ID',
name: 'customResourceId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['update'],
resource: ['custom'],
},
},
},
{
displayName: 'Update Fields',
name: 'fieldsToCreateOrUpdate',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
multipleValueButtonText: 'Add Field',
},
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['update'],
resource: ['custom'],
},
},
options: [
{
displayName: 'Field Record:',
name: 'fields',
values: [
{
displayName: 'Field Name or ID',
name: 'fieldName',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getModelFields',
},
},
{
displayName: 'New Value',
name: 'fieldValue',
type: 'string',
default: '',
},
],
},
],
},
];
@@ -0,0 +1,231 @@
import type { INodeProperties } from 'n8n-workflow';
export const noteOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'create',
noDataExpression: true,
displayOptions: {
show: {
resource: ['note'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a new note',
action: 'Create a note',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a note',
action: 'Delete a note',
},
{
name: 'Get',
value: 'get',
description: 'Get a note',
action: 'Get a note',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many notes',
action: 'Get many notes',
},
{
name: 'Update',
value: 'update',
description: 'Update a note',
action: 'Update a note',
},
],
},
];
export const noteDescription: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* note:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Memo',
name: 'memo',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['note'],
},
},
},
// {
// displayName: 'Additional Fields',
// name: 'additionalFields',
// type: 'collection',
// default: {},
// placeholder: 'Add Field',
// displayOptions: {
// show: {
// operation: [
// 'create',
// ],
// resource: [
// 'note',
// ],
// },
// },
// options: [
// {
// displayName: 'Name',
// name: 'name',
// type: 'string',
// default: '',
// },
// ],
// },
/* -------------------------------------------------------------------------- */
/* note:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Note ID',
name: 'noteId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['get', 'delete'],
resource: ['note'],
},
},
},
/* -------------------------------------------------------------------------- */
/* note:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['note'],
operation: ['getAll'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
displayOptions: {
show: {
resource: ['note'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 1000,
},
description: 'Max number of results to return',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['getAll', 'get'],
resource: ['note'],
},
},
options: [
{
displayName: 'Fields to Include',
name: 'fieldsList',
type: 'multiOptions',
description:
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getModelFields',
},
},
],
},
/* -------------------------------------------------------------------------- */
/* note:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Note ID',
name: 'noteId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['update'],
resource: ['note'],
},
},
},
{
displayName: 'Memo',
name: 'memo',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['update'],
resource: ['note'],
},
},
},
// {
// displayName: 'Update Fields',
// name: 'updateFields',
// type: 'collection',
// default: {},
// placeholder: 'Add Field',
// displayOptions: {
// show: {
// operation: [
// 'update',
// ],
// resource: [
// 'note',
// ],
// },
// },
// options: [
// {
// displayName: 'Name',
// name: 'name',
// type: 'string',
// default: '',
// },
// {
// displayName: 'Memo',
// name: 'memo',
// type: 'string',
// default: '',
// },
// ],
// },
];
@@ -0,0 +1,319 @@
import type { INodeProperties } from 'n8n-workflow';
export const opportunityOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'create',
noDataExpression: true,
displayOptions: {
show: {
resource: ['opportunity'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a new opportunity',
action: 'Create an opportunity',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete an opportunity',
action: 'Delete an opportunity',
},
{
name: 'Get',
value: 'get',
description: 'Get an opportunity',
action: 'Get an opportunity',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many opportunities',
action: 'Get many opportunities',
},
{
name: 'Update',
value: 'update',
description: 'Update an opportunity',
action: 'Update an opportunity',
},
],
},
];
export const opportunityDescription: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* opportunity:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Name',
name: 'opportunityName',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['opportunity'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['create'],
resource: ['opportunity'],
},
},
options: [
{
displayName: 'Email',
name: 'email_from',
type: 'string',
default: '',
},
// {
// displayName: 'Expected Closing Date',
// name: 'date_deadline',
// type: 'dateTime',
// default: '',
// },
{
displayName: 'Expected Revenue',
name: 'expected_revenue',
type: 'number',
default: 0,
},
{
displayName: 'Internal Notes',
name: 'description',
type: 'string',
default: '',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
},
{
displayName: 'Priority',
name: 'priority',
type: 'options',
default: '1',
options: [
{
name: '1',
value: '1',
},
{
name: '2',
value: '2',
},
{
name: '3',
value: '3',
},
],
},
{
displayName: 'Probability',
name: 'probability',
type: 'number',
default: 0,
typeOptions: {
maxValue: 100,
minValue: 0,
},
},
],
},
/* -------------------------------------------------------------------------- */
/* opportunity:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Opportunity ID',
name: 'opportunityId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['get', 'delete'],
resource: ['opportunity'],
},
},
},
/* -------------------------------------------------------------------------- */
/* opportunity:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['getAll'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 1000,
},
description: 'Max number of results to return',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['getAll', 'get'],
resource: ['opportunity'],
},
},
options: [
{
displayName: 'Fields to Include',
name: 'fieldsList',
type: 'multiOptions',
description:
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getModelFields',
},
},
],
},
/* -------------------------------------------------------------------------- */
/* opportunity:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Opportunity ID',
name: 'opportunityId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['update'],
resource: ['opportunity'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['update'],
resource: ['opportunity'],
},
},
options: [
{
displayName: 'Email',
name: 'email_from',
type: 'string',
default: '',
},
// {
// displayName: 'Expected Closing Date',
// name: 'date_deadline',
// type: 'dateTime',
// default: '',
// },
{
displayName: 'Expected Revenue',
name: 'expected_revenue',
type: 'number',
default: 0,
},
{
displayName: 'Internal Notes',
name: 'description',
type: 'string',
default: '',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
},
{
displayName: 'Priority',
name: 'priority',
type: 'options',
default: '1',
options: [
{
name: '1',
value: '1',
},
{
name: '2',
value: '2',
},
{
name: '3',
value: '3',
},
],
},
{
displayName: 'Probability',
name: 'probability',
type: 'number',
default: 0,
typeOptions: {
maxValue: 100,
minValue: 0,
},
},
],
},
];
@@ -0,0 +1,15 @@
import { contactDescription, contactOperations } from './ContactDescription';
import { customResourceDescription, customResourceOperations } from './CustomResourceDescription';
import { noteDescription, noteOperations } from './NoteDescription';
import { opportunityDescription, opportunityOperations } from './OpportunityDescription';
export {
customResourceDescription,
customResourceOperations,
noteDescription,
noteOperations,
contactDescription,
contactOperations,
opportunityDescription,
opportunityOperations,
};
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="150"><circle cx="75" cy="75" r="72.4" fill="#9c5789"/><circle cx="75" cy="75" r="42.7" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 166 B